mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
overlay wip
This commit is contained in:
@ -1,8 +1,7 @@
|
|||||||
import {Injectable} from 'angular2/angular2';
|
import {Injectable} from 'angular2/angular2';
|
||||||
|
|
||||||
import {IonicApp} from '../app/app';
|
|
||||||
import {IonicConfig} from '../../config/config';
|
|
||||||
import {OverlayController} from '../overlay/overlay-controller';
|
import {OverlayController} from '../overlay/overlay-controller';
|
||||||
|
import {IonicConfig} from '../../config/config';
|
||||||
import {Animation} from '../../animations/animation';
|
import {Animation} from '../../animations/animation';
|
||||||
import * as util from 'ionic/util';
|
import * as util from 'ionic/util';
|
||||||
|
|
||||||
@ -32,21 +31,24 @@ import * as util from 'ionic/util';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class Modal {
|
export class Modal {
|
||||||
|
|
||||||
constructor(app: IonicApp, config: IonicConfig) {
|
constructor(ctrl: OverlayController, config: IonicConfig) {
|
||||||
// super(app, {
|
this.ctrl = ctrl;
|
||||||
// enterAnimation: config.get('modalEnter') || 'modal-slide-in',
|
this._defaults = {
|
||||||
// leaveAnimation: config.get('modalLeave') || 'modal-slide-out',
|
enterAnimation: config.get('modalEnter') || 'modal-slide-in',
|
||||||
// })
|
leaveAnimation: config.get('modalLeave') || 'modal-slide-out',
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* TODO
|
||||||
* @param {Type} ComponentType TODO
|
* @param {Type} componentType TODO
|
||||||
* @param {Object} [opts={}] TODO
|
* @param {Object} [opts={}] TODO
|
||||||
* @returns {TODO} TODO
|
* @returns {TODO} TODO
|
||||||
*/
|
*/
|
||||||
open(ComponentType: Type, opts={}) {
|
open(componentType: Type, opts={}) {
|
||||||
return this.create(OVERLAY_TYPE, ComponentType, opts);
|
|
||||||
|
|
||||||
|
return this.ctrl.open(OVERLAY_TYPE, componentType, util.extend(this._defaults, opts));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,9 +58,9 @@ export class Modal {
|
|||||||
*/
|
*/
|
||||||
get(handle) {
|
get(handle) {
|
||||||
if (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>
|
<button (click)="openModalCustomAnimation()">Modal: Custom Animation</button>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
|
<ion-overlay></ion-overlay>
|
||||||
|
@ -16,7 +16,7 @@ export class OverlayAnchor {
|
|||||||
loader: DynamicComponentLoader
|
loader: DynamicComponentLoader
|
||||||
) {
|
) {
|
||||||
if (overlayCtrl.anchor) {
|
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;
|
this.elementRef = elementRef;
|
||||||
|
@ -255,9 +255,9 @@ export class Popup {
|
|||||||
*/
|
*/
|
||||||
get(handle) {
|
get(handle) {
|
||||||
if (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