A switch button for your app, based on ngSwitch.
import { SwitchButtonModule } from 'switch-button/switch-button.module';
@NgModule({ imports: [SwitchButtonModule], ... })
Single:
<switch-button [value]="switch.value" (change)="onChange($event)"></switch-button>
switch: Data = { value: false };
onChange(checked) {
this.switch.value = checked;
}
Multiple:
<div *ngFor="let switch of switches; let i = index">
<switch-button [value]="switch.value" (change)="onChange($event, i)"></switch-button>
</div>
switches: Data[] = [{ value: true }, { value: false }, { value: false }, { value: true }];
onChange(checked, index) {
this.switches[index].value = checked;
}