dan
dan

Reputation: 2957

How do you get the router name to use in a template inside a for navigation loop using Aurelia Framework

I need to get the router.name defined in the routes.

Code

 <li repeat.for="row of router.navigation" data=${row.name}
 </li>

The code above does not get the route name. I know all of the information I need is in the NavModel but I don't know how to access it in my above example using a for loop in the template

Upvotes: 1

Views: 26

Answers (1)

Sean Hunter
Sean Hunter

Reputation: 1051

You're very close there. What you're looking for is:

${row.config.name}

You can see the full route meta-data available by logging it out to the console in the app.js view-model:

enter image description here

This is also useful for if you what to include anything from the route settings in your nav.

Upvotes: 1

Related Questions