-1

so I'm trying to uderstand where's the error in my code, when I access /dashboard it just loads the template of the first route 'root', which is SYSTEM_VARS.includes.general.root but loads the console.log inside the resolve of state root.dashboard.home

I have the ui-view directive added in index.html

Please check my routes.js file

The console logging the console.logs of the routes:

State ROOT: Resolve root
Current State: DASHBOARD
Current State: DASHBOARD.HOME

the content of /dashboard state template is just an <h1>DASHBOARD HOME</h1> for tests Short: the /dashboard state aren't loading the template and controller configured.

2
  • Where is your app module/app.js. I don't see you declaring your app as an Angular app - you don't have ng-app="yourApp" in your index.html. Commented Feb 27, 2016 at 23:00
  • External code reference links are bad. Please add the code to the question, as is required at SO. Commented Dec 13, 2016 at 21:53

1 Answer 1

2

Please be aware that dots inside the state names produce nested states. Every nested state wants to be included in a ui-view in the parent state's template.

This seems to be set up correctly between root.dashboard and root.dashboard.home.

But the template of root.dashboard itself is not inserted correctly into your index page because you used an unnamed ui-view in the index page, but configured your state to use a named view called contentView. This should be fixed as soon as you remove the views property and just define the template as uiView. The root.dashboard state should look like this:

{
    abstract: true,
    url: '/dashboard',
    template: uiView,
    resolve: {
        data: [function () {
             console.warn('Current State: DASHBOARD');
        }]
    }
}

For reference, please see: https://github.com/angular-ui/ui-router/wiki/Multiple-Named-Views#example---name-matching

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your explanation!! This works and I understand this situation now, thank you!!!!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.