Toggle (change) event

I think the solution is to change how ion-toggle works so that it only fires change events if the user has clicked it and the animation has completed. It doesn’t make sense to fire a change event if the model object changes value due to some other reason.

My workaround was to add an if block like this inside the change handler:

handleToggleChange(evt) {
   if(evt.checked !== myModel.active) {
      //dispatch ngrx store event here, which ends up setting myModel.active via observables.
   }
}

I’m not happy with this solution, but it works in my use case.

6 Likes