I created a component and loaded it multiple times on the same page. All other data bindings work fine, the only problem arrived when I started using a dynamic radiobutton list with (click) event in the same component. Click event hits but this always targets the first instance of the component, no matter which instance i click.
Below is the code snippet: my component html file: <div> <ul> <li *ngFor="let option of options"> <input type="radio" (click)="getValue(option)">{{option}} </li> </ul> </div> <div id="divyesno" hidden="true"> ........ </div> my component ts file: getValue(selected:string){ var divyesno = document.getElementById("divyesno"); var divyesnoparent = divyesno.parentElement.innerHTML; .... } app.component.html (which calls my above component multiple times) <div *ngFor="let item of items"> <app-component ......> </app-component > </div> Now i have checked the parent element in the my component ts file, it always refer to the first component on the main app page. Please help..!! Thanks -- 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 angular+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/angular/e60a826e-1711-4d5f-816f-87feb799cfdfo%40googlegroups.com.