I'm trying to use ui-router with lazyload, from chrome I can see the required js is loaded but angular throws an error.
From the error I can tell the controller is not initialised, attached the router code:
var app = angular.module('aaaaa', ['oc.lazyLoad', 'ui.router']);
app.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/pages/dashboard');
$stateProvider.state('index', {
url: '/pages/:name',
templateUrl: function($stateParams) {
return 'templates/' + $stateParams.name + '.html';
},
controllerProvider: function($stateParams) {
return $stateParams.name;
},
resolve: {
loader: ['$ocLazyLoad', '$stateParams', function($ocLazyLoad, $stateParams) {
var url = 'templates/controllers/' + $stateParams.name + '.js';
console.log(url);
return $ocLazyLoad.load({
name: 'aaaaa',
files: [url]
});
}]
}
});
});
Am I missing something?