mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-18 08:20:13 +01:00
fix(bug): temporary fix for ng2-bootstrap modals (#493)
This commit is contained in:
parent
0838696218
commit
ca89355e96
2 changed files with 26 additions and 2 deletions
|
|
@ -4,7 +4,7 @@ import { GlobalState } from './global.state';
|
|||
import { BaImageLoaderService, BaThemePreloader, BaThemeSpinner } from './theme/services';
|
||||
import { layoutPaths } from './theme/theme.constants';
|
||||
import { BaThemeConfig } from './theme/theme.config';
|
||||
|
||||
import {ComponentsHelper } from 'ng2-bootstrap';
|
||||
/*
|
||||
* App Component
|
||||
* Top Level Component
|
||||
|
|
@ -30,6 +30,8 @@ export class App {
|
|||
private _config: BaThemeConfig,
|
||||
private viewContainerRef: ViewContainerRef) {
|
||||
|
||||
this._fixModals();
|
||||
|
||||
this._loadImages();
|
||||
|
||||
this._state.subscribe('menu.isCollapsed', (isCollapsed) => {
|
||||
|
|
@ -48,4 +50,26 @@ export class App {
|
|||
// register some loaders
|
||||
BaThemePreloader.registerLoader(this._imageLoader.load(layoutPaths.images.root + 'sky-bg.jpg'));
|
||||
}
|
||||
|
||||
private _fixModals(): void {
|
||||
ComponentsHelper.prototype.getRootViewContainerRef = function () {
|
||||
// https://github.com/angular/angular/issues/9293
|
||||
if (this.root) {
|
||||
return this.root;
|
||||
}
|
||||
var comps = this.applicationRef.components;
|
||||
if (!comps.length) {
|
||||
throw new Error("ApplicationRef instance not found");
|
||||
}
|
||||
try {
|
||||
/* one more ugly hack, read issue above for details */
|
||||
var rootComponent = this.applicationRef._rootComponents[0];
|
||||
this.root = rootComponent._component.viewContainerRef;
|
||||
return this.root;
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error("ApplicationRef instance not found");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue