我在使用 ui-router 加载按需控制器 js 文件时遇到问题,并报错:
参数 'FormController' 不是
我的代码是:
'use strict';
var Request = angular.module('Request',['ui.router','oc.lazyLoad'])
.config(function($stateProvider) {
$stateProvider.state('form', {
url: "/form",
templateUrl: "view/form1.html",
controller:'FormController as form',
resolve: {
form: function( $ocLazyLoad ){
return $ocLazyLoad.load(
{
name:'form',
files:['app/controller/FormController.js']
}
)
}
}
});
我的控制器是:
'use strict';
Request.controller('FormController',function($scope){
$scope.text = 'This is Form Controller';
})