Angular2: I am trying to pass values from an *ngFor loop as a parameter to function call on the (click) attribute (since calling functions on onclick is not allowed for security reasons) event on my anchor tag.
Template Code:
<div *ngFor='let artist of artists'>
<a (click)="alert({{artist.artist_id}})" href="#">{{artist.artist_name}}</a>
</div>
Compile Time error:
Got interpolation ({{}}) where expression was expected in [alert({{artist.artist_id}})]
Problem:
How do I pass the value of artist to the function call on (click)?
Any/All help appreciated! :)
()or[]together with{{}}. Either one or the other but not together. (()and[]can be used together).()and[]together always remind me of the sweet[(ngModel)].