Created
July 30, 2017 16:11
-
-
Save dafma/1ccafcd2120c3672f6c4219a6da997e5 to your computer and use it in GitHub Desktop.
tooglee ionic 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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