demos(actionSheet): update actionsheet

This commit is contained in:
Adam Bradley
2015-12-31 20:15:58 -06:00
parent e0b0d7ac30
commit 5c43f7bc35
3 changed files with 32 additions and 34 deletions

View File

@ -1,2 +1 @@
<ion-nav id="nav" [root]="rootPage" #content></ion-nav>
<ion-overlay></ion-overlay>
<ion-nav [root]="rootPage"></ion-nav>

View File

@ -1,51 +1,50 @@
import {App, Page, IonicApp, Config, Platform} from 'ionic/ionic';
import {ActionSheet} from 'ionic/ionic';
import {App, Page, ActionSheet, NavController} from 'ionic/ionic';
@App({
templateUrl: 'app.html'
})
class ApiDemoApp {
constructor() {
this.rootPage = InitialPage;
}
}
@Page({
templateUrl: 'main.html'
})
export class InitialPage {
constructor(actionSheet: ActionSheet, platform: Platform) {
this.actionSheet = actionSheet;
this.platform = platform;
constructor(nav: NavController) {
this.nav = nav;
}
open() {
this.actionSheet.open({
present() {
let actionSheet = ActionSheet.create({
buttons: [
{ text: 'Share'},
{ text: 'Play'},
{ text: 'Favorite'}
],
destructiveText: 'Delete',
titleText: 'Albums',
cancelText: 'Cancel',
cancel: () => {
console.log('Canceled');
},
destructiveButtonClicked: () => {
console.log('Destructive clicked');
},
buttonClicked: (index) => {
console.log('Button clicked', index);
if (index == 1) { return false; }
return true;
}
}).then(actionSheetRef => {
this.actionSheetRef = actionSheetRef;
{
text: 'Destructive',
style: 'destructive',
handler: () => {
console.log('Destructive clicked');
}
},
{
text: 'Archive',
handler: () => {
console.log('Archive clicked');
}
},
{
text: 'Cancel',
style: 'cancel',
handler: () => {
console.log('Cancel clicked');
}
}
]
});
this.nav.present(actionSheet);
}
}

View File

@ -4,6 +4,6 @@
<ion-content padding>
<ion-row>
<button full block (click)="open()">Open Action Sheet</button>
<button full block (click)="present()">Open Action Sheet</button>
</ion-row>
<ion-content>