samedi 9 mai 2015

Angular New Router and grandchildren routes

I cannot find any examples on how to make grandchildren routes in the Angular New Router (1.4).

As I understand from a tutorial the router config is per component. And a component is self-contained and not aware of other components.

If I have a users component, and this component gives all users, and then this components has a child component that gives info on a specific user.

Is the following directory structure correct?

/app.js /app.html /components/users/users.js /components/users/users.html /components/users/components/user/user.js /components/users/components/user/user.html

Where /app.js contains the following route config:

$router.config([
 {path: '/users', component: 'users' }
]);

And /components/users/users.js contains the following route config:

$router.config([
 {path: '/user', component: 'user' }
]);

So the path in this example would be /users/user.

I probably have misunderstood, because when I tried it, it did not work. So anybody knows a tutorial or could enlighten me on how this really should be done?

Aucun commentaire:

Enregistrer un commentaire