Session: Angular main.ts file

13 August, 2021 - 1 min read

About the session

Yesterday, As part of my spontaneous video broadcasts which under the name: 'Angular & Whiskey', I hacked The main.ts together with the community.
Keep exploring!

Watch the video

The main.ts snippet

async function bootstrap() {
const config = await fetch('http://localhost:3000/config').then( res => res.json() );
// You can provide static providers to the created platform
const browserPlatform = platformBrowserDynamic([
{ provide: ConsoleLogger }
// After bootstrapping your module you can use thק appModuleRef to configure
// The module injector, and get access to this module components
// example: `const applicationRef = appModuleRef.injector.get<ApplicationRef>(ApplicationRef);`
const appModuleRef: NgModuleRef<AppModule> = await browserPlatform.bootstrapModule(AppModule);
// It is possible to bootstrap modules depend on certain condition
if(config.alerts) {
await browserPlatform.bootstrapModule(AlertModule, {
ngZone: 'noop'
view raw main.ts hosted with ❤ by GitHub