我得到了angular.js:11598 Error: [ng:areq] Argument 'FormDemoCtrl' is not a function
但是,我无法使用调试器来跟踪chrome控制台上的根本原因。我怎样才能找到断点的起点?
因为有缺陷的点位于angular.js:11598 但我确定这个bug来自我自己的代码而不是angular.js。
DEMO页面http://www.alphaloan.co/ngAdmin/admin.html#/app/form/elements
我尝试访问上一个州loan.form.banks
控制器在js/controllers/form.js
.config(
[ '$stateProvider', '$urlRouterProvider', 'JQ_CONFIG',
function ($stateProvider, $urlRouterProvider, JQ_CONFIG) {
$urlRouterProvider
.otherwise('/loan/form/banks');
$stateProvider
.state('loan', {
abstract: true,
url: '/loan',
templateUrl: 'tpl/admin.html',
})
.state('loan.form', {
url: '/form',
template: '<div ui-view class="fade-in"></div>',
resolve: {
deps: ['uiLoad',
function( uiLoad ){
return uiLoad.load('js/controllers/form.js');
}]
}
})
.state('loan.form.banks', {
url: '/banks',
templateUrl: 'tpl/admin_banks.html',
resolve: {
deps: ['uiLoad',
function( uiLoad ){
return uiLoad.load('js/controllers/form.js');
}]
}
})
}]
VM17515 angular.js:11598Error: [ng:areq] Argument 'FormDemoCtrl' is not a function, got undefined
http://errors.angularjs.org/1.3.11/ng/areq?p0=FormDemoCtrl&p1=not%20aNaNunction%2C%20got%20undefined
at http://localhost:3000/bower_components/angular/angular.js:63:12
at assertArg (http://localhost:3000/bower_components/angular/angular.js:1577:11)
at assertArgFn (http://localhost:3000/bower_components/angular/angular.js:1587:3)
at http://localhost:3000/bower_components/angular/angular.js:8422:9
at http://localhost:3000/bower_components/angular/angular.js:7596:34
at forEach (http://localhost:3000/bower_components/angular/angular.js:331:20)
at nodeLinkFn (http://localhost:3000/bower_components/angular/angular.js:7583:11)
at compositeLinkFn (http://localhost:3000/bower_components/angular/angular.js:7075:13)
at publicLinkFn (http://localhost:3000/bower_components/angular/angular.js:6954:30)
at http://localhost:3000/bower_components/angular-ui-router/release/angular-ui-router.js:3905:9(anonymous function) @ VM17515 angular.js:11598(anonymous function) @ VM17515 angular.js:8548invokeLinkFn @ VM17515 angular.js:8219nodeLinkFn @ VM17515 angular.js:7726compositeLinkFn @ VM17515 angular.js:7075publicLinkFn @ VM17515 angular.js:6954updateView @ angular-ui-router.js:3839(anonymous function) @ angular-ui-router.js:3807invokeLinkFn @ VM17515 angular.js:8217nodeLinkFn @ VM17515 angular.js:7726compositeLinkFn @ VM17515 angular.js:7075publicLinkFn @ VM17515 angular.js:6954(anonymous function) @ angular-ui-router.js:3905invokeLinkFn @ VM17515 angular.js:8217nodeLinkFn @ VM17515 angular.js:7726compositeLinkFn @ VM17515 angular.js:7075publicLinkFn @ VM17515 angular.js:6954updateView @ angular-ui-router.js:3839(anonymous function) @ angular-ui-router.js:3807invokeLinkFn @ VM17515 angular.js:8217nodeLinkFn @ VM17515 angular.js:7726compositeLinkFn @ VM17515 angular.js:7075compositeLinkFn @ VM17515 angular.js:7078publicLinkFn @ VM17515 angular.js:6954(anonymous function) @ angular-ui-router.js:3905invokeLinkFn @ VM17515 angular.js:8217nodeLinkFn @ VM17515 angular.js:7726compositeLinkFn @ VM17515 angular.js:7075publicLinkFn @ VM17515 angular.js:6954updateView @ angular-ui-router.js:3839(anonymous function) @ angular-ui-router.js:3801Scope.$broadcast @ VM17515 angular.js:14707$state.transition.resolved.then.$state.transition @ angular-ui-router.js:3218processQueue @ VM17515 angular.js:13175(anonymous function) @ VM17515 angular.js:13191Scope.$eval @ VM17515 angular.js:14388Scope.$digest @ VM17515 angular.js:14204$delegate.__proto__.$digest @ VM17549:844Scope.$apply @ VM17515 angular.js:14493$delegate.__proto__.$apply @ VM17549:855(anonymous function) @ VM17515 angular.js:16219completeOutstandingRequest @ VM17515 angular.js:4902(anonymous function) @ VM17515 angular.js:5282
2admin.html#/app/form/elements:1 The specified value "appledaily.com.tw" is not a valid email address.
controllers/bootstrap.js
已加载到admin.html,
但是,其他控制器未加载。那是因为其他控制器被加载了
$stateProvider
resolve: {
deps: ['uiLoad',
function( uiLoad ){
return uiLoad.load('js/controllers/form.js');
}]
}
<script src="js/app.js"></script>
<script src="js/config.admin.js"></script>
<script src="js/config.lazyload.js"></script>
<script src="js/config.admin.router.js"></script>
<script src="js/main.js"></script>
<script src="js/services/ui-load.js"></script>
<script src="js/controllers/bootstrap.js"></script>