扫码关注官方订阅号
这样写起作用:controller: 'loginctrl as loginctrl'我写controller: 'loginctrl'就不行,怎么回事呢?
认证高级PHP讲师
ng1.2 中引入了 controllerAs,也就是你用的 ctrl as ctrl,主要是为了不必注入 $scope 和 controller 本身的轻量化。
如果要用回原来的 ng-controller 的话。就不能使用 this 绑定 scope 了,得手工注入 $scope。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
ng1.2 中引入了 controllerAs,也就是你用的 ctrl as ctrl,主要是为了不必注入 $scope 和 controller 本身的轻量化。
如果要用回原来的 ng-controller 的话。就不能使用 this 绑定 scope 了,得手工注入 $scope。