I made AngularJs app by typescript. and use requireJs load 'js(compiled ts) file'
I made simple controller A
myCtrl.ts
module myApp {
'use strict';
interface myMessage extends ng.IScope {
message: string;
}
export class myCtrl {
constructor($scope: myMessage) {
$scope.message = "hello world";
}
}
}
and I load myApp file in main.ts
myApp.ts
import myController = require('./myCtrl');
module myApp{
'use strict';
angular.module('myApp',[]).controller('myCtrl',myCtrl);
}
angular.bootstrap(document,['myAppDo']);
load was success but $scope.message not changed.
'Cannot read property 'myCtrl' of undefined'
when I change myApp.ts it work's fine
angular.module('myApp', []).controller('myCtrl', ($scope, $http) => {
$scope.message = "hello";
});
angular.bootstrap(document,['myApp']);
how can I Solve?