Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include two functions in (click) angular 5

Tags:

angular

I want to include to two function on click

<li class="active" (click) ="routeTransaction(), activateClass(classChange)" *ngIf="permissionKeys.indexOf('TRANSACTIONS')>-1" [ngClass]="{'liactive': classChange}" >
    <a >
      <i class="glyphicon glyphicon-cog"></i>
          <span>Transaction</span>
    </a>
</li>

This is giving an error; how could it be fixed?

like image 422
mano10 Avatar asked Jul 31 '18 06:07

mano10


2 Answers

Seperate them by semicolon. Its the same like writing multiple statements inside a block scope.

<li class="active" (click) ="routeTransaction(); activateClass(classChange)" *ngIf="permissionKeys.indexOf('TRANSACTIONS')>-1" [ngClass]="{'liactive': classChange}" >
like image 97
Amit Chigadani Avatar answered Oct 02 '22 23:10

Amit Chigadani


You need to separate by ; not by ,

 (click) ="routeTransaction(); activateClass(classChange)
like image 33
Sajeetharan Avatar answered Oct 02 '22 23:10

Sajeetharan