Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Condition based click event in Angular 2

Tags:

angular

In my application I would like to have conditional based click event ,

<div class="trashIconDiv" (click)="if(idx > 0) {removeSelected(item.spId)}"> 

In the above code removeSelected function should be executed only when idx >0 , any idea how to implement

like image 693
refactor Avatar asked Jul 14 '17 06:07

refactor


1 Answers

(click)="idx > 0 && removeSelected(item.spId)" 
like image 89
yurzui Avatar answered Oct 18 '22 20:10

yurzui