Skip to content

Instantly share code, notes, and snippets.

@7freaks-otte
7freaks-otte / sf-toggle.component.ts
Last active April 17, 2021 06:12
Short-term workaround until ionic2 <ion-toggle> ionChange events are fixed
import {Component, EventEmitter, Optional} from '@angular/core';
import {ControlValueAccessor, NgControl} from '@angular/forms';
import {Item} from 'ionic-angular';
/*
* ion-toggle replacement written by Michael Otte (7freaks.com) in order to
* - prevent ionChange events on setting ngModel https://github.com/driftyco/ionic/issues/7806
* - emit (change) event only if user interaction has taken place
*
* Usage: