docs(demos/actionSheet): actionSheet api demo

This commit is contained in:
Drew Rygh
2015-12-09 10:06:19 -06:00
parent 474831e66b
commit 7b665490d9
3 changed files with 34 additions and 16 deletions

View File

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

View File

@@ -1,41 +1,51 @@
import {App, ActionSheet} from 'ionic/ionic';
import {App, Page, IonicApp, Config, Platform} from 'ionic/ionic';
import {ActionSheet} from 'ionic/ionic';
@App({
templateUrl: 'app.html'
})
class ApiDemoApp {
constructor() {
this.rootPage = InitialPage;
}
}
@Page({
templateUrl: 'main.html'
})
class IonicApp {
constructor(actionSheet: ActionSheet) {
export class InitialPage {
constructor(actionSheet: ActionSheet, platform: Platform) {
this.actionSheet = actionSheet;
this.platform = platform;
}
openMenu() {
open() {
this.actionSheet.open({
buttons: [
{ text: 'Share This' },
{ text: 'Move' }
{ text: 'Share'},
{ text: 'Play'},
{ text: 'Favorite'}
],
destructiveText: 'Delete',
titleText: 'Modify your album',
titleText: 'Albums',
cancelText: 'Cancel',
cancel: function() {
cancel: () => {
console.log('Canceled');
},
destructiveButtonClicked: () => {
console.log('Destructive clicked');
},
buttonClicked: function(index) {
buttonClicked: (index) => {
console.log('Button clicked', index);
if(index == 1) { return false; }
if (index == 1) { return false; }
return true;
}
}).then(actionSheetRef => {
this.actionSheetRef = actionSheetRef;
});
}
}

View File

@@ -1,3 +1,9 @@
<ion-navbar *navbar>
<ion-title>Action Sheet</ion-title>
</ion-navbar>
<ion-content padding>
<button (click)="openMenu()">Open Action Sheet</button>
</ion-content>
<ion-row>
<button full block (click)="open()">Open Action Sheet</button>
</ion-row>
<ion-content>