Faiq Faiq -4 years ago 161
HTML Question

How to pass angular 2 variable's value to javascript function?

enter image description here

This is my image
I want to pass "c.name" and "c.image_Url" in onclick function as given in image

Answer Source
<div *ngFor="let c of categories" (click)="selectedCategory(c.name,c.image_url)">

     //<---note (click) event - angular2 way element's click binding


In component,

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download