我正在尝试在达到相应状态时加载 js 和 css 我是 isunf 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
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)