Ion-toggle ng-checked does not call the function at all


#1

Hi,

the ng-checked of my ion-toggle does not call the function I want it to call.

   <ion-toggle (ionChange)="toggle($event, item.id)" (ng-checked)="checkToggle(item.id)"></ion-toggle

and the function in the typescript file is,

 checkToggle(id: string)
    {
         console.log("Returning True");
         return true;
    }

But when the toggles remain unchecked when the page is loaded and I don’t see any logs in the console.


#2

I got it to work by using [checked] instead of (ng-checked).

<ion-toggle (ionChange)="toggle($event, item.id)" [checked]="checkToggle(item.id)"></ion-toggle>

But I would like to know why (ng-checked) didn’t work.