mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
overlay wip
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,3 +7,4 @@
|
||||
<button (click)="openModalCustomAnimation()">Modal: Custom Animation</button>
|
||||
</ion-content>
|
||||
|
||||
<ion-overlay></ion-overlay>
|
||||
|
@ -16,7 +16,7 @@ export class OverlayAnchor {
|
||||
loader: DynamicComponentLoader
|
||||
) {
|
||||
if (overlayCtrl.anchor) {
|
||||
throw ('An app should only have one <ion-overlays></ion-overlays>');
|
||||
throw ('An app should only have one <ion-overlay></ion-overlay>');
|
||||
}
|
||||
|
||||
this.elementRef = elementRef;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user