MCPcopy Create free account
hub / github.com/angular/angular / AppModule

Class AppModule

packages/examples/core/ts/platform/platform.ts:41–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39
40@NgModule({imports: [BrowserModule], declarations: [ComponentOne, ComponentTwo]})
41export class AppModule implements DoBootstrap {
42 // #docregion componentSelector
43 ngDoBootstrap(appRef: ApplicationRef) {
44 this.fetchDataFromApi().then((componentName: string) => {
45 if (componentName === 'ComponentOne') {
46 appRef.bootstrap(ComponentOne);
47 } else {
48 appRef.bootstrap(ComponentTwo);
49 }
50 });
51 }
52 // #enddocregion
53
54 fetchDataFromApi(): Promise<string> {
55 return new Promise((resolve) => {
56 setTimeout(() => {
57 resolve('ComponentTwo');
58 }, 2000);
59 });
60 }
61}
62
63@NgModule({imports: [BrowserModule], declarations: [ComponentThree]})
64export class AppModuleTwo implements DoBootstrap {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected