You can pass the id value from the template to the function (AngulasJS2).
template: ` <div class="container" *ngFor="#mov of movs"> ..// <button class="btn btn-primary" type="button" ..// (click)="test(id)" [id]="mov" > ..// ..// test(id: string) { //test var logo1: HTMLElement = document.getElementById(id); ..// }
right now i use it and it works,
(click)="test(''+mov)" [id]="mov"
but does not work with this code.
(click)="test(id)" [id]="mov"
Sorry for my english
source share