Let say the code is like below:
page.html
<ion-toggle [(ngModel)]='somethingOn' (ngModelChange)='statusChange($event)'></ion-toggle>
page.ts
import { Diagnostic } from '@ionic-native/diagnostic/ngx';
export class Page implements OnInit {
somethingOn: boolean;
constructor(private diagnostic: Diagnostic) {
// should be some codes here?
}
ngOnInit() {
}
statusChange(e) {
// or should be some codes here?
if (this.somethingOn) {
// ...
} else {
// ...
}
}
}
How to run Diagnostic checking (e.g. isLocationOn) before switching on ion-toggle in each time?
Thank you.