refactor(demos): give each component section its own view

This commit is contained in:
Drew Rygh
2015-10-08 10:01:13 -05:00
parent c3eed60d22
commit dcebbeaf56
40 changed files with 985 additions and 276 deletions

View File

@ -0,0 +1,9 @@
<ion-navbar *navbar class="show-navbar">
<ion-title>Action Sheet</ion-title>
</ion-navbar>
<ion-content class="has-header components-demo padding">
<button block (click)="openMenu()">
Show Actionsheet
</button>
</ion-content>

View File

@ -0,0 +1,64 @@
import {IonicPlatform, IonicView, ActionSheet} from 'ionic/ionic';
@IonicView({
templateUrl: 'actionSheet/actionSheet.html',
})
export class ActionSheetPage {
constructor(actionSheet: ActionSheet, platform: IonicPlatform) {
this.actionSheet = actionSheet;
this.platform = platform;
}
openMenu() {
if (this.platform.is('android')) {
var androidSheet = {
buttons: [
{ text: 'Share', icon: 'share' },
{ text: 'Play', icon: 'arrow-dropright-circle'},
{ text: 'Favorite', icon: 'ion-md-heart-outline'}
],
destructiveText: 'Delete',
titleText: 'Purchased',
cancelText: 'Cancel',
cancel: function() {
console.log('Canceled');
},
destructiveButtonClicked: () => {
console.log('Destructive clicked');
},
buttonClicked: function(index) {
console.log('Button clicked', index);
if (index == 1) { return false; }
return true;
}
};
}
this.actionSheet.open(androidSheet || {
buttons: [
{ text: 'Share This' },
{ text: 'Move' }
],
destructiveText: 'Delete',
titleText: 'You Opened Action Sheet',
cancelText: 'Cancel',
cancel: function() {
console.log('Canceled');
},
destructiveButtonClicked: () => {
console.log('Destructive clicked');
},
buttonClicked: function(index) {
console.log('Button clicked', index);
if (index == 1) { return false; }
return true;
}
}).then(actionSheetRef => {
this.actionSheetRef = actionSheetRef;
});
}
}