0

The initial view, as well as the first State to be displayed properly, but when I click on the link of the first reloaded view the next State does not appear. Below the codepen. The URL is modified but the new content will not be reloaded.

Any idea?

2 Answers 2

0

It's because you have set the second state to be a child of the first, but you don't have a view for it to render in. When you use a state-name such as new.two you are effectively saying: Render state "two" into the the child-view of state "new".

If that was the goal, then you need to add a ui-view into the template of the first state. If that wasn't the case, then change new.two to just two.

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

Comments

0

You do not have ui-view in your parent state.

    .state('new', {
      controller: "AsdCtrl",
      url: '/new',
      template: "<h1>TEST</h1><a ui-sref='new.two'>Lalalal</a><div ui-view></div>"
    })

This state should have ui-view like so in order to load the child html.

Child states will load their templates into their parent's ui-view.

Read more here

And here you go the working codepen

2 Comments

But then the new view is only displayed underneath. However I would like to replace the complete view by the new state
Then two should not be a child of new. You should name is just two instead of new.two.

Your Answer

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