看到这种写法
//app.js
angular.module('app',['app.controllers']);
//FirstController.js
angular.module('app.controllers').controller('firstCtrl',function($scope){...})
//SecondController.js
angular.module('app.controllers').controller('SecondCtrl',function($scope){...})
但是我这么写缺报 firstCtrl 和 SecondCtrl 不是一个方法,刚开始学习angular,求帮助
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
建议这么写
这条语句的前提是你有一个view的ng-app是app.controllers。
module函数的第一个参数就是ng-app的值。
controller函数就是定义该module下的一个控制器。