I am currently geting an error trying to use states defined on my submodule. I am working on this AngularJS-Boilerplate and they code in a way that i am not very used to.
This is my main module:
;(function() {
/**
* Definition of the main app module and its dependencies
*/
angular
.module('boilerplate', [
'ui.router',
'boilerplate.demo'
])
.config(config);
config.$inject = ['$locationProvider', '$stateProvider', '$httpProvider', '$compileProvider', '$authProvider'];
function config($locationProvider, $stateProvider, $httpProvider, $compileProvider, $authProvider) {
$locationProvider.html5Mode(false);
$httpProvider.interceptors.push('authInterceptor');
$authProvider.facebook({
clientId: '471453806577471',
responseType: 'token'
});
}
/**
* Run block
*/
angular
.module('boilerplate')
.run(run);
run.$inject = ['$rootScope', '$state', '$stateParams','$location'];
function run($rootScope, $state, $stateParams, $location) {
$state.go('boilerplate.home');
}
})();
This is my submodule:
;(function() {
/**
* Definition of the main app module and its dependencies
*/
angular
.module('boilerplate.demo', [
'ui.router',
])
.config(config);
// safe dependency injection
// this prevents minification issues
config.$inject = ['$stateProvider'];
function config($stateProvider) {
console.log('states');
$stateProvider
.state('boilerplate.home', {
url: '/home',
templateUrl: 'app/demo/partials/home.html',
controller: 'MainController',
controllerAs: 'vm'
})
}
})();
I get this error:
angular.js:11706 Error: Could not resolve 'boilerplate.home' from state ''
If I put $stateProvider in the main module and change the controllers module also to the main module it works. Any help?