0

I have the following state defined in my app module.

$stateProvider .state('app', { abstract: true, url: '/', views: { 'header': { templateUrl: 'header.tpl.html' }, 'content': { template: 'Content goes here' }, 'footer': { templateUrl: 'footer.tpl.html' } } });

But, I want to put header and footer in separate angular modules and load them as module dependency. Like - app.header & app.footer

Since, I can not redeclare a state. And, two states with same url doesn't work. So, is there any way I can achieve this?

1 Answer 1

1

Probably this is a bit old, but I guess answering might be useful as a future ref.
Have a look at this issue on ui-router GitHub, it seems to me that it could help.

The gist of the thing is represented by the following 2 code blocks:

// File1.js
angular.module('myApp').config(function($stateProvider) {
    $stateProvider
        .state("toplevelfeature", {
            url: '/topleavelFeature'...
        })
        .state("toplevelfeature2", {
            url: '/topleavelFeature2'...
        })
        .state("toplevelfeature.midfeature", {
            url: '/midFeature'...
        })
        .state("toplevelfeature.midfeature2", {
            url: '/midFeature2...'
        })
        .state("toplevelfeature.midfeature.anothernestedfeature", {
            url: '/anothernestedfeature...'
        })
});

// File2.js
angular.module('myApp').config(function($stateProvider) {
    $stateProvider
        .state("toplevelfeature.midfeature.anothernestedfeature.home", {...
        })
        .state("toplevelfeature.midfeature.anothernestedfeature.detail", {...
        })
        .state("toplevelfeature.midfeature.anothernestedfeature.other", {...
        })
});
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.