docs(demos): add content to modal demo

Closes #449
This commit is contained in:
Drew Rygh
2015-11-09 10:55:51 -06:00
parent ddafee9829
commit 6b50942f1e
7 changed files with 121 additions and 32 deletions

View File

@ -1,5 +1,5 @@
import {App, IonicApp, Animation, Modal, NavController, Page, Events} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import {App, IonicApp, Animation, Modal, Platform, NavController, Page, Events} from 'ionic/ionic';
import {forwardRef, NgFor} from 'angular2/angular2';
import * as helpers from '../../helpers';
@ -7,35 +7,75 @@ import * as helpers from '../../helpers';
templateUrl: 'modals/basic/template.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
class ModalsFirstPage {
class ModalsInitialPage {
constructor(
nav: NavController,
modal: Modal,
events: Events
) {
this.nav = nav;
this.modal = modal;
}
openModal() {
this.modal.open(ModalsContentPage);
openModal(characterNum) {
this.modal.open(ModalsContentPage, characterNum);
}
}
@Page({
templateUrl: 'modals/basic/modals-content.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
templateUrl: 'modals/basic/modal-content.html',
directives: [NgFor, forwardRef(() => helpers.AndroidAttribute)]
})
class ModalsContentPage {
constructor(
modal: Modal,
events: Events
) {
this.modal = modal;
constructor(
modal: Modal,
platform: Platform,
) {
this.modal = modal;
if (platform.is('android')) {
this.currentPlatform = 'android';
} else {
this.currentPlatform = 'ios';
}
var characters = [
{
name: 'Gollum',
quote: 'Sneaky little hobbitses!',
image: 'img/avatar-gollum.jpg',
items: [
{ title: 'Race', note: 'Hobbit' },
{ title: 'Culture', note: 'River Folk' },
{ title: 'Alter Ego', note: 'Smeagol' }
]
},
{
name: 'Frodo',
quote: 'Go back, Sam! I\'m going to Mordor alone!',
image: 'img/avatar-frodo.jpg',
items: [
{ title: 'Race', note: 'Hobbit' },
{ title: 'Culture', note: 'Shire Folk' },
{ title: 'Weapon', note: 'Sting' }
]
},
{
name: 'Samwise Gamgee',
quote: 'What we need is a few good taters.',
image: 'img/avatar-samwise.jpg',
items: [
{ title: 'Race', note: 'Hobbit' },
{ title: 'Culture', note: 'Shire Folk' },
{ title: 'Nickname', note: 'Sam' }
]
}
];
this.character = characters[this.modal._defaults.charNum];
}
closeModal() {
@ -51,7 +91,7 @@ class ModalsContentPage {
})
export class BasicPage {
constructor(modal: Modal) {
this.rootView = ModalsFirstPage;
this.rootView = ModalsInitialPage;
this.modal = modal;
}
onPageWillLeave() {
@ -61,3 +101,5 @@ export class BasicPage {
}
}
}