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,13 @@
<ion-pane padding>
<button block danger (click)="closeModal()">
<icon close></icon>
Close Modal
</button>
</ion-pane>

View File

@ -0,0 +1,14 @@
<ion-navbar *navbar class="show-navbar">
<ion-title>Modals</ion-title>
</ion-navbar>
<ion-content class="has-header padding">
<button block (click)="openModal()">
Show Modal
</button>
</ion-content>

View File

@ -0,0 +1,80 @@
import {App, IonicApp, Animation, Modal, NavController, IonicView, Events} from 'ionic/ionic';
import * as helpers from 'helpers';
@IonicView({
templateUrl: 'modals/modals.html'
})
class ModalsFirstPage {
constructor(
nav: NavController,
modal: Modal,
events: Events
) {
this.nav = nav;
this.modal = modal;
}
openModal() {
this.modal.open(ModalsContentPage, {
handle: 'my-awesome-modal',
enterAnimation: 'my-fade-in',
leaveAnimation: 'my-fade-out'
});
}
}
@IonicView({
templateUrl: 'modals/modals-content.html'
})
class ModalsContentPage {
constructor(
modal: Modal,
events: Events
) {
this.modal = modal;
}
closeModal() {
let modal = this.modal.get();
if (modal) {
modal.close();
}
}
}
@IonicView({
template: '<ion-nav [root]="rootView"></ion-nav>'
})
export class ModalsPage {
constructor() {
this.rootView = ModalsFirstPage;
}
}
class FadeIn extends Animation {
constructor(element) {
super(element);
this
.easing('ease')
.duration(450)
.fadeIn();
}
}
Animation.register('my-fade-in', FadeIn);
class FadeOut extends Animation {
constructor(element) {
super(element);
this
.easing('ease')
.duration(250)
.fadeOut();
}
}
Animation.register('my-fade-out', FadeOut);