Closed ghost closed 8 years ago
@iloveyo123u1 hey actually the best solution is using template reference variable, following is the change from your plnkr code , you can directly get the id .
`<button (click)="onClick(ff.id)" id="test" #ff>Click</button>`
thank you @ShiYuanjun-Tim
<img (click)="setImg()" src="1.jpg
">我想点击这个图,就把这个图对应的地址,传送给setImg 这个函数
我试着传入 $event,似乎是可以获取到图,但是好像太麻烦了
有更加简便的办法吗