1

Is there any method to create a childRouter in angular, just like in durandal 2.0?

The router will controll the content in ngView. In ngView, I'd like to make some childRouters which are different from router and controll some contents in ngView too.

When the childRouter changed, the url of the whole website should be changed.

The reason for using childRouter is that the childRouters are different in different ngView, and I need to organize them.

wolfgod
  • 43
  • 5
  • See ui-router: https://github.com/angular-ui/ui-router – Ilan Frumer Feb 28 '14 at 10:14
  • The simplicity of Durandal and it's router are what make it so powerful. To achieve the same thing in Angular I would suggest building your own router or be stuck with an opinionated one. – PW Kad Feb 28 '14 at 14:40

1 Answers1

0

You may want to take a look at this question: Complex nesting of partials and templates

As the most voted answer states, ng-router doesn't support child routes yet.

The Ui-Router projet may provide the features you're looking for.

I've been using it for a while and it works very well.

Community
  • 1
  • 1
Timothée Jeannin
  • 9,652
  • 2
  • 56
  • 65
  • Here is a
    in my homepage, and a
    in a partials html. The "main" view will be filled by the "content" view. But then I found the "content" view doesn't work. I do not know how to write the $stateProvider function for this situation. Does ui-router not support two-level-routers either?
    – wolfgod Feb 28 '14 at 13:27
  • Angular UI router supports multiple levels for routes. If you have problems using it, feel free to ask another question on this website. (you may also want to select an answer as the correct answer to your question so that other programmers can quickly find the correct answer if they have the same question) – Timothée Jeannin Mar 14 '14 at 10:58
  • Finally, I make it. Thanks a lot – wolfgod Mar 23 '14 at 16:21