Skip to content

Frequently Asked Questions

jeme edited this page Apr 29, 2013 · 94 revisions

How do i configure ui-router from multiple modules, it doesn't seem to get the same state provider?

What often goes wrong is dependencies. E.g:

angular.module('application', [...]).config(function ($stateProvider) {
    $stateProvider
        .state("feature1", { url : '/Feature1'...})
        .state("feature2", { url : '/Feature2'...});
});
angular.module('feature1', ['application', ...]).config(function ($stateProvider) {
    $stateProvider
        .state("feature1.home", {...})
        .state("feature1.detail", {...});
});

Note: Remember only to declare dependencies ones on module creation, so if you make several calls to angular.module for the same module, only the first should define dependencies.

Clone this wiki locally