mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
80 lines
1.8 KiB
TypeScript
80 lines
1.8 KiB
TypeScript
import { Component, NgModule } from '@angular/core';
|
|
import { ActionSheetController, IonicModule, Platform } from 'ionic-angular';
|
|
|
|
|
|
@Component({
|
|
templateUrl: 'main.html'
|
|
})
|
|
export class ApiDemoPage {
|
|
constructor(public alertCtrl: ActionSheetController, public platform: Platform) { }
|
|
|
|
present() {
|
|
let actionSheet = this.alertCtrl.create({
|
|
title: 'Albums',
|
|
buttons: [
|
|
{
|
|
text: 'Delete',
|
|
role: 'destructive',
|
|
icon: !this.platform.is('ios') ? 'trash' : null,
|
|
handler: () => {
|
|
console.log('Delete clicked');
|
|
}
|
|
},
|
|
{
|
|
text: 'Share',
|
|
icon: !this.platform.is('ios') ? 'share' : null,
|
|
handler: () => {
|
|
console.log('Share clicked');
|
|
}
|
|
},
|
|
{
|
|
text: 'Play',
|
|
icon: !this.platform.is('ios') ? 'arrow-dropright-circle' : null,
|
|
handler: () => {
|
|
console.log('Play clicked');
|
|
}
|
|
},
|
|
{
|
|
text: 'Favorite',
|
|
icon: !this.platform.is('ios') ? 'heart-outline' : null,
|
|
handler: () => {
|
|
console.log('Favorite clicked');
|
|
}
|
|
},
|
|
{
|
|
text: 'Cancel',
|
|
role: 'cancel', // will always sort to be on the bottom
|
|
icon: !this.platform.is('ios') ? 'close' : null,
|
|
handler: () => {
|
|
console.log('Cancel clicked');
|
|
}
|
|
}
|
|
]
|
|
});
|
|
|
|
actionSheet.present();
|
|
}
|
|
}
|
|
|
|
|
|
@Component({
|
|
template: '<ion-nav [root]="root"></ion-nav>'
|
|
})
|
|
export class ApiDemoApp {
|
|
root = ApiDemoPage;
|
|
}
|
|
|
|
@NgModule({
|
|
declarations: [
|
|
ApiDemoApp,
|
|
ApiDemoPage
|
|
],
|
|
imports: [
|
|
IonicModule.forRoot(ApiDemoApp)
|
|
],
|
|
bootstrap: [IonicApp],
|
|
entryComponents: [
|
|
ApiDemoPage
|
|
]
|
|
})
|
|
export class AppModule {} |