I'm trying to create a dynamic navigation menu and have the links in the
nav work with the angular router framework.
<table id=main-menu-table *ngFor="#menuItem of mainMenuItems">
<tr>
<td><a [routerLink]="['{{menuItem.id}}']" href="{{menuItem.url}}">
{{menuItem.titleText}}</a></td>
</tr>
</table>
My 'id' is a string type that is the route name; e.g. TestRouteName
When I try to do the above I get a console error: Parser Error: Got
interpolation ({{}}) where expression was expected at column 1 in
[[{{menuItem.id}}]]
I thought I found an answer to this problem here:
https://github.com/angular/angular/issues/4020
But I've tried a couple variations and keep getting error's related to my
[routerLink] binding. I've tried:
[routerLink]="['menuItem.id']"
[routerLink]="[menuItem.id]"
[routerLink]="[id]"
[routerLink]="[{{menuItem.id}}]"
But keep getting the parse error. Is there a way to do this?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.