Writing like this works: controller: 'loginctrl as loginctrl' It doesn't work when I write controller: 'loginctrl'. What's going on?
认证高级PHP讲师
ng1.2 introduced controllerAs, which is what you use ctrl as ctrl, mainly to avoid having to inject $scope and the lightweight controller itself.
If you want to use the original ng-controller. You cannot use this to bind scope, and you have to manually inject $scope.
ng1.2 introduced controllerAs, which is what you use ctrl as ctrl, mainly to avoid having to inject $scope and the lightweight controller itself.
If you want to use the original ng-controller. You cannot use this to bind scope, and you have to manually inject $scope.