My application has the following code:
angular.module('home', []) .controller('homeHomeController', HomeHomeController) .controller('homeContentController', HomeContentController);
and
class HomeHomeController { static $inject = [ '$http', 'examService', 'stateService', 'userService' ]; constructor( private $http: ng.IHttpService, private $es: IExamService, private $ss: IStateService, private $us: IUserService ) { var self = this; } }
I just upgraded to AngularJS 1.3 and now I get this error:
Error: [ng:areq] Argument 'HomeHomeController' is not a function, got undefined http://errors.angularjs.org/1.3.0/ng/areq?p0=HomeHomeController&p1=not%20aNaNunction%2C%20got%20undefined at http://127.0.0.1:17315/Scripts/angular.js:80:12 at assertArg (http://127.0.0.1:17315/Scripts/angular.js:1610:11) at assertArgFn (http://127.0.0.1:17315/Scripts/angular.js:1620:3) at http://127.0.0.1:17315/Scripts/angular.js:8319:9 at http://127.0.0.1:17315/Scripts/angular.js:7496:34 at forEach (http://127.0.0.1:17315/Scripts/angular.js:343:20) at nodeLinkFn (http://127.0.0.1:17315/Scripts/angular.js:7483:11) at compositeLinkFn (http://127.0.0.1:17315/Scripts/angular.js:6991:13) at publicLinkFn (http://127.0.0.1:17315/Scripts/angular.js:6870:30) at compile (http://127.0.0.1:17315/Scripts/angular-ui-router.js:3335:9)
Here is how I do the router configuration:
app.config([ '$httpProvider', '$locationProvider', '$sceProvider', '$stateProvider', appConfig ]); function appConfig( $httpProvider, $locationProvider, $sceProvider, $stateProvider: ng.ui.IStateProvider ) { $locationProvider.html5Mode(true); .. var home = { name: 'home', url: '/Home', views: { 'root': { templateUrl: '/Content/app/home/partials/home.html', }, 'content': { templateUrl: '/Content/app/home/partials/overview.html', }, } }; .. $stateProvider .. .state(home) ;
The following is the loading order of the script:
<script src="Scripts/jquery-2.1.1.min.js"></script> <script src="/Scripts/angular.js"></script> <script src="/Scripts/angular-ui-router.js"></script> ... <script src="/Content/app/home/controllers/HomeController.js"></script> <script src="/Content/app/home/home.js"></script> <script src="/Content/app/app.js"></script> <script src="/Content/app/appConfig.js"></script> <script src="/Content/app/appRun.js"></script>
Can someone tell me if there is aproblem with how I define my controller using Typescript?