From dc8c2e76b09e9a89739a381fe2c367c593b6bb51 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Sun, 4 Oct 2015 22:48:18 -0500 Subject: [PATCH] overlay wip --- ionic/components/modal/modal.ts | 26 +++++++++++---------- ionic/components/modal/test/basic/main.html | 1 + ionic/components/overlay/overlay.ts | 2 +- ionic/components/popup/popup.ts | 4 ++-- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ionic/components/modal/modal.ts b/ionic/components/modal/modal.ts index 51bdb32056..7900a2ffd9 100644 --- a/ionic/components/modal/modal.ts +++ b/ionic/components/modal/modal.ts @@ -1,8 +1,7 @@ import {Injectable} from 'angular2/angular2'; -import {IonicApp} from '../app/app'; -import {IonicConfig} from '../../config/config'; import {OverlayController} from '../overlay/overlay-controller'; +import {IonicConfig} from '../../config/config'; import {Animation} from '../../animations/animation'; import * as util from 'ionic/util'; @@ -32,21 +31,24 @@ import * as util from 'ionic/util'; @Injectable() export class Modal { - constructor(app: IonicApp, config: IonicConfig) { - // super(app, { - // enterAnimation: config.get('modalEnter') || 'modal-slide-in', - // leaveAnimation: config.get('modalLeave') || 'modal-slide-out', - // }) + constructor(ctrl: OverlayController, config: IonicConfig) { + this.ctrl = ctrl; + this._defaults = { + enterAnimation: config.get('modalEnter') || 'modal-slide-in', + leaveAnimation: config.get('modalLeave') || 'modal-slide-out', + }; } /** * TODO - * @param {Type} ComponentType TODO + * @param {Type} componentType TODO * @param {Object} [opts={}] TODO * @returns {TODO} TODO */ - open(ComponentType: Type, opts={}) { - return this.create(OVERLAY_TYPE, ComponentType, opts); + open(componentType: Type, opts={}) { + + + return this.ctrl.open(OVERLAY_TYPE, componentType, util.extend(this._defaults, opts)); } /** @@ -56,9 +58,9 @@ export class Modal { */ get(handle) { if (handle) { - return this.getByHandle(handle, OVERLAY_TYPE); + return this.ctrl.getByHandle(handle, OVERLAY_TYPE); } - return this.getByType(OVERLAY_TYPE); + return this.ctrl.getByType(OVERLAY_TYPE); } } diff --git a/ionic/components/modal/test/basic/main.html b/ionic/components/modal/test/basic/main.html index 9e2e9aaba0..5b6b688259 100644 --- a/ionic/components/modal/test/basic/main.html +++ b/ionic/components/modal/test/basic/main.html @@ -7,3 +7,4 @@ + diff --git a/ionic/components/overlay/overlay.ts b/ionic/components/overlay/overlay.ts index c2ad7f8e1b..8ec71dac36 100644 --- a/ionic/components/overlay/overlay.ts +++ b/ionic/components/overlay/overlay.ts @@ -16,7 +16,7 @@ export class OverlayAnchor { loader: DynamicComponentLoader ) { if (overlayCtrl.anchor) { - throw ('An app should only have one '); + throw ('An app should only have one '); } this.elementRef = elementRef; diff --git a/ionic/components/popup/popup.ts b/ionic/components/popup/popup.ts index bd45911ce7..a8df93832f 100644 --- a/ionic/components/popup/popup.ts +++ b/ionic/components/popup/popup.ts @@ -255,9 +255,9 @@ export class Popup { */ get(handle) { if (handle) { - return this.getByHandle(handle, OVERLAY_TYPE); + return this.ctrl.getByHandle(handle, OVERLAY_TYPE); } - return this.getByType(OVERLAY_TYPE); + return this.ctrl.getByType(OVERLAY_TYPE); } }