Created
August 28, 2018 01:35
-
-
Save sumbad/225eb48ba7e2040d2526477a333f73a2 to your computer and use it in GitHub Desktop.
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 characters
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | |
import { AppModule } from './app/app.module'; | |
import { environment } from 'environments/environment'; | |
/** | |
* Bootstrap our Angular app with a top level NgModule | |
*/ | |
export function main(): Promise<any> { | |
return platformBrowserDynamic() | |
.bootstrapModule(AppModule, { | |
preserveWhitespaces: true | |
}) | |
.then(environment.decorateModuleRef) | |
.catch((err) => console.error(err)); | |
} | |
/** | |
* Needed for hmr | |
* in prod this is replace for document ready | |
*/ | |
switch (document.readyState) { | |
case 'loading': | |
document.addEventListener('DOMContentLoaded', _domReadyHandler, false); | |
break; | |
case 'interactive': | |
case 'complete': | |
default: | |
main(); | |
} | |
function _domReadyHandler() { | |
document.removeEventListener('DOMContentLoaded', _domReadyHandler, false); | |
main(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment