Reputation: 305
Is there anyway we can set id conditionally in angular2. Lets say I have a component template.
<span id="setTextId()">
I want to set my id return by this setTextId() function how can i do that?
Upvotes: 1
Views: 3269
Reputation: 19622
span [id]="setTextId()"
In Component the method will be
id : number = 0;
setTextId(){
this.id++
}
Upvotes: 3