Skip to content

Instantly share code, notes, and snippets.

@dafma
Created July 30, 2017 16:11
Show Gist options
  • Save dafma/1ccafcd2120c3672f6c4219a6da997e5 to your computer and use it in GitHub Desktop.
Save dafma/1ccafcd2120c3672f6c4219a6da997e5 to your computer and use it in GitHub Desktop.
tooglee ionic 3
<ion-header>
<ion-navbar>
<ion-title>
Ionic Blank
</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<div padding style="text-align: center;">
<h1>Ionic 2 Test</h1>
<ion-toggle [(ngModel)]="toggleStatus" pulsado checked="false" (ionChange)="Change_Toggle(toggleStatus);"></ion-toggle>
{{greeting}}
</div>
</ion-content>
import { Component, SimpleChange } from '@angular/core';
import { NavController,} from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
greeting: string;
toggleStatus:boolean;
constructor(public navCtrl: NavController) {
this.toggleStatus =true;
}
OnChanges(changes: {[propertyName: string]: SimpleChange}){
for (let propName in changes) {
if (propName ==='toggleStatus'){
let chng = changes[propName];
this.Change_Toggle(chng.currentValue);
}
}
}
Change_Toggle(bval:any) {
if (bval===true)
this.greeting="toggle true"
else
this.greeting="toggle false"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment