Skip to content

Commit a8aaaea

Browse files
chore: module to standalone done
1 parent d24d043 commit a8aaaea

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

apps/angular/31-module-to-standalone/src/app/app.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component } from '@angular/core';
2+
import { RouterLink, RouterOutlet } from '@angular/router';
23

34
@Component({
45
selector: 'app-root',
@@ -25,6 +26,7 @@ import { Component } from '@angular/core';
2526
host: {
2627
class: 'flex flex-col p-4 gap-3',
2728
},
28-
standalone: false,
29+
standalone: true,
30+
imports: [RouterLink, RouterOutlet],
2931
})
3032
export class AppComponent {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { provideToken } from '@angular-challenges/module-to-standalone/core/providers';
2+
import { ApplicationConfig } from '@angular/core';
3+
import { provideRouter, withComponentInputBinding } from '@angular/router';
4+
import { appRoutes } from 'libs/module-to-standalone/shell/src/lib/main-shell.routes';
5+
6+
export const appConfig: ApplicationConfig = {
7+
providers: [
8+
provideRouter(appRoutes, withComponentInputBinding()),
9+
provideToken('main-shell-token'),
10+
],
11+
};

apps/angular/31-module-to-standalone/src/app/app.module.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2-
import { AppModule } from './app/app.module';
1+
import { bootstrapApplication } from '@angular/platform-browser';
2+
import { AppComponent } from './app/app.component';
3+
import { appConfig } from './app/app.config';
34

4-
platformBrowserDynamic()
5-
.bootstrapModule(AppModule)
6-
.catch((err) => console.error(err));
5+
bootstrapApplication(AppComponent, appConfig).catch((e) => console.error(e));

0 commit comments

Comments
 (0)