Hi,
I am using Angular 2, Typescript and BootStrap components.
I have a table in which I am adding various data. In the last column I'm
adding a BootStrap button.
When I click one of these buttons I want it to change color (and other
things), however all the buttons in the column are changing color.
Presumably I need to use the $event to specifically identify a button?
i.e. event.target.id
Maybe I am just going about this all wrong?
////In the Template
<tr *ngFor="let object of objects">
<td>
...
</td>
<td class="action" align="center">
<button data-toggle="collapse"
(click)="toggleColor($event)"
class="btn btn-{{buttonType}} btn-xs">
</button>
</td>
</tr>
////In the Component
buttonType = 'default'
toggleColor(event) {
if(this.buttonType == 'success') {
this.buttonType = 'default';
} else {
this.buttonType = 'success'
}
}
If someone could offer some advice it would be great.
Thanks
Rob S
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" 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.