Skip to content

Commit 11136e6

Browse files
author
Alain Boudard
committed
fix: standalone router api & component input binding
1 parent aabc908 commit 11136e6

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

application/ng-shell/src/bootstrap.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@ import { withInterceptorsFromDi, provideHttpClient } from '@angular/common/http'
1010
import { BrowserModule, bootstrapApplication } from '@angular/platform-browser';
1111
import { FormsModule } from '@angular/forms';
1212
import { CustomPageTitleStrategy } from './app/services/custom-page-title-strategy';
13-
import { RouterModule, TitleStrategy } from '@angular/router';
13+
import { provideRouter, TitleStrategy, withComponentInputBinding, withHashLocation, withRouterConfig } from '@angular/router';
1414

1515
if (environment.production) {
1616
enableProdMode();
1717
}
1818

1919
bootstrapApplication(AppComponent, {
2020
providers: [
21+
provideRouter(APP_ROUTES, withComponentInputBinding(), withHashLocation(), withRouterConfig({paramsInheritanceStrategy: 'always'})),
22+
2123
importProvidersFrom(
2224
FormsModule,
2325
BrowserModule,
24-
RouterModule.forRoot(APP_ROUTES, { useHash: true }),
2526
StoreModule.forRoot(reducers, { metaReducers }),
2627
CoreModule,
2728
!environment.production ? StoreDevtoolsModule.instrument() : []),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<h2>Detail view of order ID</h2>
2-
<h3>Order N° : </h3>
2+
<h3>Order N° : {{ id }}</h3>

library/mfe1/src/app/orders/view/view.component.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ import { Component, Input } from '@angular/core';
99
})
1010
export class ViewComponent {
1111

12-
// @Input() id!: string;
13-
14-
// public id$: Observable<any>;
15-
16-
/*constructor(private activatedRoute: ActivatedRoute) {
17-
this.id$ = this.activatedRoute.params.pipe(map((p) => p['id']));
18-
}*/
12+
@Input() id!: string;
1913

2014
}

library/mfe1/src/bootstrap.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { enableProdMode, importProvidersFrom } from '@angular/core';
2-
import { RouterModule } from '@angular/router';
2+
import { provideRouter, withComponentInputBinding, withHashLocation, withRouterConfig } from '@angular/router';
33
import { APP_ROUTES } from './app/app.routes';
44
import { environment } from './environments/environment';
55
import { AppComponent } from './app/app.component';
@@ -15,9 +15,11 @@ if (environment.production) {
1515

1616
bootstrapApplication(AppComponent, {
1717
providers: [
18+
19+
provideRouter(APP_ROUTES, withComponentInputBinding(), withHashLocation(), withRouterConfig({paramsInheritanceStrategy: 'always'})),
20+
1821
importProvidersFrom(
1922
BrowserModule,
20-
RouterModule.forRoot(APP_ROUTES, { useHash: true }),
2123
StoreModule.forRoot(reducers, { metaReducers }),
2224
!environment.production ? StoreDevtoolsModule.instrument() : []),
2325
provideHttpClient(withInterceptorsFromDi())

0 commit comments

Comments
 (0)