Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note on devtools/router-store incompatibility #237

Closed
wants to merge 1 commit into from

Conversation

karptonite
Copy link
Contributor

There is a note about this problem in the migration guide, but anyone who is new to the project may miss the migration guide. A note belongs in the devtools docs as well.

There is a note about this problem in the migration guide, but anyone who is new to the project may miss the migration guide. A note belongs in the devtools docs as well.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 91.269% when pulling 43c5d11 on karptonite:patch-6 into 2b1a076 on ngrx:master.

MikeRyanDev pushed a commit that referenced this pull request Aug 9, 2017
This adds a serializer that can be customized for returning the router state snapshot. By default, the entire RouterStateSnapshot is returned. Documentation has been updated with example usage.

```ts
import { StoreModule } from '@ngrx/store';
import {
  StoreRouterConnectingModule,
  routerReducer,
  RouterStateSerializer
} from '@ngrx/router-store';

export interface RouterStateUrl {
  url: string;
}

export class CustomSerializer implements RouterStateSerializer<RouterStateUrl> {
  serialize(routerState: RouterStateSnapshot): RouterStateUrl {
    const url = routerState ? routerState.url : '';

    // Only return an object including the URL
    // instead of the entire snapshot
    return { url };
  }
}

@NgModule({
  imports: [
    StoreModule.forRoot({ routerReducer: routerReducer }),
    RouterModule.forRoot([
      // routes
    ]),
    StoreRouterConnectingModule
  ],
  providers: [
    { provide: RouterStateSerializer, useClass: CustomSerializer }
  ]
})
export class AppModule { }
```

Closes #97, #104, #237
@MikeRyanDev MikeRyanDev closed this Aug 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants