mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
docs(demos/popup): api demo
This commit is contained in:
2
demos/popup/app.html
Normal file
2
demos/popup/app.html
Normal file
@@ -0,0 +1,2 @@
|
||||
<ion-nav id="nav" [root]="rootPage" #content></ion-nav>
|
||||
<ion-overlay></ion-overlay>
|
||||
53
demos/popup/index.ts
Normal file
53
demos/popup/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import {App, Page, IonicApp, Config, Platform} from 'ionic/ionic';
|
||||
import {Popup} from 'ionic/ionic';
|
||||
|
||||
@App({
|
||||
templateUrl: 'app.html'
|
||||
})
|
||||
class ApiDemoApp {
|
||||
|
||||
constructor() {
|
||||
this.rootPage = InitialPage;
|
||||
}
|
||||
}
|
||||
|
||||
@Page({
|
||||
templateUrl: 'main.html'
|
||||
})
|
||||
export class InitialPage {
|
||||
constructor(popup: Popup) {
|
||||
this.popup = popup;
|
||||
this.confirmOpen = false;
|
||||
this.confirmResult = '';
|
||||
}
|
||||
|
||||
doAlert() {
|
||||
this.popup.alert({
|
||||
title: "New Friend!",
|
||||
template: "Your friend, Obi wan Kenobi, just accepted your friend request!",
|
||||
cssClass: 'my-alert'
|
||||
});
|
||||
}
|
||||
|
||||
doPrompt() {
|
||||
this.popup.prompt({
|
||||
title: "New Album",
|
||||
template: "Enter a name for this new album you're so keen on adding",
|
||||
inputPlaceholder: "Title",
|
||||
okText: "Save"
|
||||
});
|
||||
}
|
||||
|
||||
doConfirm() {
|
||||
this.confirmOpen = true;
|
||||
this.popup.confirm({
|
||||
title: "Use this lightsaber?",
|
||||
subTitle: "You can't exchange lightsabers",
|
||||
template: "Do you agree to use this lightsaber to do good across the intergalactic galaxy?",
|
||||
cancelText: "Disagree",
|
||||
okText: "Agree"
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
9
demos/popup/main.html
Normal file
9
demos/popup/main.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<ion-navbar *navbar>
|
||||
<ion-title>Popup</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
<ion-content padding>
|
||||
<button dark (click)="doAlert()">Alert</button>
|
||||
<button light (click)="doPrompt()">Prompt</button>
|
||||
<button primary (click)="doConfirm()">Confirm</button>
|
||||
<ion-content>
|
||||
Reference in New Issue
Block a user