i have put the ui-router-extras into my project to add state by lazy load module, it works fine, and i put the controller , factory , provider etc into to another module just like module1.controller. the module1 depend the module.controller, the state defined in module1 require the controller which has defined in module.controller. the module1 code :
define(['angularAMD',
'ngload!module1.controller'], function (angularAMD) {
var app = angular.module("module1", ['ui.router', 'module1.controller']);
var mainState = {
name: 'module1',
url: '/module1',
template: '<h1>Module1</h1><h4>This state was dynamically loaded from module1.js</h4>' +
'<div>module1.js defines 3 nested states</div>' +
'<div><a ui-sref=".state1">go to state1</a></div><div ui-view></div>',
controller: 'Ctl1'
};
...
the module1.controller code:
define(['angular', 'angularAMD'], function (angular, angularAMD) {
var controller = angular.module("module1.controller", []);
controller.controller("Ctl1", ['$scope', function ($scope) {
$scope.Welcome = {};
$scope.Welcome.Message = "welcome to module1";
}]);
angularAMD.processQueue();
});
when the app run, i got an exception : Error: [ng:areq] Argument 'Ctl1' is not a function, got undefined
what can i do for it?