Last active
November 14, 2019 12:26
-
-
Save bisubus/fbef01fdb3b14e7349aead9b00701260 to your computer and use it in GitHub Desktop.
Revisions
-
bisubus revised this gist
Feb 17, 2018 . 1 changed file with 14 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ import { Inject, Type, ApplicationRef, ComponentFactoryResolver } from '@angular/core'; import { DOCUMENT } from '@angular/common'; @NgModule({ @@ -7,17 +8,20 @@ import { DOCUMENT } from '@angular/common'; entryComponents: [App, Bpp] }) export class AppModule { static bootstrapComponents: Type[] = [App, Bpp]; constructor( @Inject(DOCUMENT) private _document: any, private _componentFactoryResolver: ComponentFactoryResolver ) {} ngDoBootstrap(applicationRef: ApplicationRef) { for (const component of AppModule.bootstrapComponents) { const { selector } = this._componentFactoryResolver.resolveComponentFactory(component); if (this._document.querySelector(selector)) { applicationRef.bootstrap(component); } } } } -
bisubus created this gist
Feb 16, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ import { Inject, ApplicationRef } from '@angular/core'; import { DOCUMENT } from '@angular/common'; @NgModule({ imports: [BrowserModule], declarations: [App, Bpp], entryComponents: [App, Bpp] }) export class AppModule { constructor(@Inject(DOCUMENT) private _document: any) {} ngDoBootstrap(applicationRef: ApplicationRef) { const document = this._document; if (document.querySelector('app')) { applicationRef.bootstrap(App); } if (document.querySelector('bpp')) { applicationRef.bootstrap(Bpp); } } }