I'm currently building an application in Angular2. In this application i grab my menu items from an array that is built like this:
this.navigationItems = [
{
name: 'Name',
url: ['/url'],
attributes: [
{
customAttribute: 'key="value"'
}
]
}
}
My template looks like this:
<footer id="app-navigation">
<ul class="app-navigation__list">
<li class="app-navigation__item" *ngFor="let item of navigationItems"><a [routerLink]="item.url">{{ item.name }}</a>
<ul class="app-navigation__sublist" *ngIf="item.subitems">
<li class="app-navigation__subitem" *ngFor="let subItem of item.subitems"><a>{{ subItem.name }}</a></li>
</ul>
</li>
</ul>
</footer>
I want to be able to insert the assigned attribute, if it exists. Say i have the "page" as name, and a custom attribute, i want to insert the attribute into my template, as it is in the object.
Does my explanation make any sense, if not i'd be glad to deepen. Long story short, want to
<a #CUSTOMATTRIBUTE-IF-PRESENT#>{{ item.name }}</a>
Thanks in advance :)