mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
@@ -27,10 +27,13 @@ class MyAppCmp {
|
||||
platform.ready().then(() => {
|
||||
console.log('platform.ready')
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
openModal() {
|
||||
this.modal.open(PlainPage);
|
||||
}
|
||||
|
||||
openModalChildNav() {
|
||||
this.modal.open(ContactModal, {
|
||||
handle: 'my-awesome-modal'
|
||||
});
|
||||
@@ -44,10 +47,27 @@ class MyAppCmp {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Page({
|
||||
template: `
|
||||
<p>Plain Page in a modal</p>
|
||||
<p>Not inside of ion-content</p>
|
||||
<p><button (click)="closeModal()">Close Modal</button></p>
|
||||
`
|
||||
})
|
||||
class PlainPage {
|
||||
constructor(private modal: Modal) {}
|
||||
|
||||
closeModal() {
|
||||
this.modal.get().close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Page({
|
||||
template: '<ion-nav [root]="rootView"></ion-nav>'
|
||||
})
|
||||
export class ContactModal {
|
||||
class ContactModal {
|
||||
constructor() {
|
||||
console.log('ContactModal constructor')
|
||||
this.rootView = ModalFirstPage;
|
||||
@@ -94,7 +114,7 @@ export class ContactModal {
|
||||
</ion-content>
|
||||
`
|
||||
})
|
||||
export class ModalFirstPage {
|
||||
class ModalFirstPage {
|
||||
constructor(
|
||||
nav: NavController,
|
||||
modal: Modal,
|
||||
@@ -158,7 +178,7 @@ export class ModalFirstPage {
|
||||
</ion-content>
|
||||
`
|
||||
})
|
||||
export class ModalSecondPage {
|
||||
class ModalSecondPage {
|
||||
constructor(
|
||||
nav: NavController,
|
||||
params: NavParams
|
||||
@@ -181,7 +201,6 @@ class FadeIn extends Animation {
|
||||
.fadeIn();
|
||||
}
|
||||
}
|
||||
|
||||
Animation.register('my-fade-in', FadeIn);
|
||||
|
||||
class FadeOut extends Animation {
|
||||
@@ -193,5 +212,4 @@ class FadeOut extends Animation {
|
||||
.fadeOut();
|
||||
}
|
||||
}
|
||||
|
||||
Animation.register('my-fade-out', FadeOut);
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
|
||||
<ion-content padding>
|
||||
<button class="e2eOpenModal" (click)="openModal()">Modal: Default Animation</button>
|
||||
</ion-content>
|
||||
|
||||
<ion-content padding>
|
||||
<button (click)="openModalCustomAnimation()">Modal: Custom Animation</button>
|
||||
<p>
|
||||
<button class="e2eOpenModal" (click)="openModalChildNav()">Open modal w/ child ion-nav</button>
|
||||
</p>
|
||||
<p>
|
||||
<button (click)="openModal()">Open plain modal</button>
|
||||
</p>
|
||||
<p>
|
||||
<button (click)="openModalCustomAnimation()">Modal: Custom Animation</button>
|
||||
</p>
|
||||
</ion-content>
|
||||
|
||||
<ion-overlay></ion-overlay>
|
||||
|
||||
Reference in New Issue
Block a user