angular.js - 请问angularjs的路由指定controller时怎么不能直接写controller的名字呢?
PHP中文网
PHP中文网 2017-05-15 16:58:46
0
1
451

这样写起作用:controller: 'loginctrl as loginctrl'
我写controller: 'loginctrl'就不行,怎么回事呢?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
阿神

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template