mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
33 lines
724 B
TypeScript
33 lines
724 B
TypeScript
import {Component, View, ElementRef, DynamicComponentLoader} from 'angular2/angular2';
|
|
|
|
import {OverlayController} from './overlay-controller';
|
|
|
|
|
|
@Component({
|
|
selector: 'ion-overlay'
|
|
})
|
|
@View({
|
|
template: ''
|
|
})
|
|
export class OverlayAnchor {
|
|
constructor(
|
|
overlayCtrl: OverlayController,
|
|
elementRef: ElementRef,
|
|
loader: DynamicComponentLoader
|
|
) {
|
|
if (overlayCtrl.anchor) {
|
|
throw ('An app should only have one <ion-overlay></ion-overlay>');
|
|
}
|
|
|
|
this.elementRef = elementRef;
|
|
this.loader = loader;
|
|
overlayCtrl.anchor = this;
|
|
}
|
|
|
|
append(componentType) {
|
|
return this.loader.loadNextToLocation(componentType, this.elementRef).catch(err => {
|
|
console.error(err);
|
|
});
|
|
}
|
|
}
|