Skip to content

Commit 74b0415

Browse files
committed
migrate to standalone bootstrap
1 parent 91a6d5d commit 74b0415

File tree

3 files changed

+20
-25
lines changed

3 files changed

+20
-25
lines changed

apps/ng-demo/src/app/app.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { Component } from '@angular/core';
2+
import { HeaderComponent } from '../components/header/header.component';
3+
import { RouterOutlet } from '@angular/router';
24

35
@Component({
46
selector: 'app-root',
@@ -17,6 +19,6 @@ import { Component } from '@angular/core';
1719
}
1820
`,
1921
],
20-
standalone: false
22+
imports: [HeaderComponent, RouterOutlet]
2123
})
2224
export class AppComponent {}

apps/ng-demo/src/app/app.module.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

apps/ng-demo/src/main.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
22

3-
import { AppModule } from './app/app.module';
3+
import { BrowserModule, bootstrapApplication } from '@angular/platform-browser';
4+
import {
5+
withInterceptorsFromDi,
6+
provideHttpClient,
7+
} from '@angular/common/http';
8+
import { provideRouter } from '@angular/router';
9+
import { appRoutes } from './app/app.routes';
10+
import { HeaderModule } from './components/header/header.component';
11+
import { AppComponent } from './app/app.component';
12+
import { importProvidersFrom } from '@angular/core';
413

5-
platformBrowserDynamic()
6-
.bootstrapModule(AppModule)
7-
.catch((err) => console.error(err));
14+
bootstrapApplication(AppComponent, {
15+
providers: [
16+
importProvidersFrom(BrowserModule, HeaderModule),
17+
provideHttpClient(withInterceptorsFromDi()),
18+
provideRouter(appRoutes),
19+
],
20+
}).catch((err) => console.error(err));

0 commit comments

Comments
 (0)