From 5c43f7bc35e16ed15f2e834f3e716040936b102c Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Thu, 31 Dec 2015 20:15:58 -0600 Subject: [PATCH] demos(actionSheet): update actionsheet --- demos/action-sheet/app.html | 3 +- demos/action-sheet/index.ts | 61 ++++++++++++++++++------------------ demos/action-sheet/main.html | 2 +- 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/demos/action-sheet/app.html b/demos/action-sheet/app.html index 5f6bb33d68..7b88c96996 100644 --- a/demos/action-sheet/app.html +++ b/demos/action-sheet/app.html @@ -1,2 +1 @@ - - \ No newline at end of file + diff --git a/demos/action-sheet/index.ts b/demos/action-sheet/index.ts index 829799ce6b..66ac40f4af 100644 --- a/demos/action-sheet/index.ts +++ b/demos/action-sheet/index.ts @@ -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); } } - diff --git a/demos/action-sheet/main.html b/demos/action-sheet/main.html index 58ebcd2cac..b0f9998425 100644 --- a/demos/action-sheet/main.html +++ b/demos/action-sheet/main.html @@ -4,6 +4,6 @@ - +