我正在尝试在达到相应的状态时加载js和css 我是OcLazyLoader和 我已经提到控制器名称,我试图使用ocloader加载控制器定义,但我得到控制器未定义
我的配置文件是
.state('menu.table', {
url: '/table',
controller: 'tableController',
templateUrl: 'module/table/table.html',
resolve :{
loadMyCtrl : ['$ocLazyLoad',function($ocLazyLoad){
return $ocLazyLoad.load({
name:"smartExpenseApp.tableController",
files:["module/table/js/table.js"]
});
}
]
}
})
和 我的table.js s
smartExpenseApp.controller('tableController',function ($scope, $log) {
$scope.names = [
{
name: 'Jani'
, country: 'Norway'
}
, {
name: 'Carl'
, country: 'Sweden'
}
, {
name: 'Margareth'
, country: 'England'
}
, {
name: 'Hege'
, country: 'Norway'
}
, {
name: 'Joe'
, country: 'Denmark'
}
, {
name: 'Gustav'
, country: 'Sweden'
}
, {
name: 'Birgit'
, country: 'Denmark'
}
, {
name: 'Mary'
, country: 'England'
}
, {
name: 'Kai'
, country: 'Norway'
}
];
$scope.sortField = "name";
$scope.sortBy = false;
$scope.sortColumn = function (column) {
$scope.sortField = column;
$scope.sortBy = $scope.sortField == (column) ? !$scope.sortBy : false;
}
$scope.getSortClass = function (column) {
if ($scope.sortField == column) {
return $scope.sortBy ? "glyphicon glyphicon-triangle-bottom" : "glyphicon glyphicon-triangle-top";
}
return 'glyphicon glyphicon-minus-sign';
}
});
请帮助解决这个问题,因为我正在
angular.js:13424 Error: [ng:areq] Argument 'tableController' is not a function, got undefined
http://errors.angularjs.org/1.5.3/ng/areq?p0=tableController&p1=not%20aNaNunction%2C%20got%20undefined
at file:///F:/Workspace/Angular/Smart%20Expense/SmartExpense-WEB/Example/common/resources/Angular/Angular/angular.js:68:12
at assertArg (file:///F:/Workspace/Angular/Smart%20Expense/SmartExpense-WEB/Example/common/resources/Angular/Angular/angular.js:1844:11)
at assertArgFn (file:///F:/Workspace/Angular/Smart%20Expense/SmartExpense-WEB/Example/common/resources/Angular/Angular/angular.js:1854:3)