Skip to content

Commit

Permalink
feat(router-store): Make usage of forRoot required (#1662) (#1672)
Browse files Browse the repository at this point in the history
Closes #1662 

BREAKING CHANGES:

usage of forRoot is now required for StoreRouterConnectingModule

BEFORE:

```ts
@NgModule({
  imports: [
    StoreRouterConnectingModule
  ]
})
export class AppModule {}
```

AFTER:

```ts
@NgModule({
  imports: [
    StoreRouterConnectingModule.forRoot()
  ]
})
export class AppModule {}
```
  • Loading branch information
EnricoVogt authored and brandonroberts committed Apr 1, 2019
1 parent 57bacf5 commit c7e1406
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions modules/router-store/src/router_store_module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,31 +122,15 @@ enum RouterTrigger {
* { path: '', component: SimpleCmp },
* { path: 'next', component: SimpleCmp }
* ]),
* StoreRouterConnectingModule
* StoreRouterConnectingModule.forRoot()
* ],
* bootstrap: [AppCmp]
* })
* export class AppModule {
* }
* ```
*/
@NgModule({
providers: [
{
provide: _ROUTER_CONFIG,
useValue: {},
},
{
provide: ROUTER_CONFIG,
useFactory: _createRouterConfig,
deps: [_ROUTER_CONFIG],
},
{
provide: RouterStateSerializer,
useClass: DefaultRouterStateSerializer,
},
],
})
@NgModule({})
export class StoreRouterConnectingModule {
static forRoot<
T extends BaseRouterStoreState = SerializedRouterStateSnapshot
Expand All @@ -157,6 +141,11 @@ export class StoreRouterConnectingModule {
ngModule: StoreRouterConnectingModule,
providers: [
{ provide: _ROUTER_CONFIG, useValue: config },
{
provide: ROUTER_CONFIG,
useFactory: _createRouterConfig,
deps: [_ROUTER_CONFIG],
},
{
provide: RouterStateSerializer,
useClass: config.serializer
Expand Down

0 comments on commit c7e1406

Please sign in to comment.