收到此错误...
Error: [ng:areq] Argument 'registerController' is not a function, got undefined
尝试转换到 ui-router 状态时...
.state('register', {
url: "/register",
templateUrl: "App/components/register/registerView.html",
data: { pageTitle: 'Register', specialClass: 'gray-bg' },
controller: "registerController",
resolve: { // Any property in resolve should return a promise and is executed before the view is loaded
loadMyCtrl: ['$ocLazyLoad', function ($ocLazyLoad) {
// you can lazy load files for an existing module
return $ocLazyLoad.load(['App/components/register/registerController.js']);
}]
}
})
延迟加载的文件被检索并运行,这里是为了提供信息。
var app = angular.module('application')
function registerController($scope) {
$scope.test = "test";
};
app.controller('registerController', registerController);
当状态试图解决
controller: "registerController",
财产。但我知道此时延迟加载的代码已经运行,并且“registerController”已注册为控制器。