我想在我的应用 Angular 中使用“angular-ui-load”。
问题是,我的脚本 js在 dev consol firefox中未定义错误:
"Error: [ng:areq] Argument 'DetailsCtrl' is not a function, got undefined
现在,在 index.html 中声明的 angular-ui-load
<!-- build:js scripts/modules.js -->
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
<!-- endbuild -->
<!-- build:js({.tmp,app}) scripts/scripts.js -->
<script src="scripts/app.js"></script>
<script src="scripts/services/ui-load.js"></script>
<script src="scripts/controllers/main.js"></script>
<script src="scripts/controllers/alert.js"></script>
<script src="scripts/controllers/users.js"></script>
<script src="scripts/directives/ui-jq.js"></script>
<!-- endbuild -->
'ui.load' 我的 app.js 是:
'use strict';
angular.module('webApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'ui.router',
'ui.load',
'ui.jq',
'zumba.angular-waypoints'
])
.run(
[ '$rootScope', '$state', '$stateParams',
function ($rootScope, $state, $stateParams) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
}
]
)
.config(function ($stateProvider, $urlRouterProvider) {
//delete $httpProvider.defaults.headers.common['X-Requested-With'];
$urlRouterProvider.otherwise('/');
$stateProvider
.state('users', {
url: '/users',
templateUrl: 'views/users.html',
controller:'UserCtrl'
})
.state('users.details', {
url: '/details/:id_user',
templateUrl: 'views/details.html',
//controller:'UserCtrl'
resolve: {
deps: ['uiLoad',
function( uiLoad){
return uiLoad.load('scripts/controllers/details.js');
}]
}
})
})
任何帮助,将不胜感激 :-) ?