From 7cd10dbd9c39a47292f134bee2f6e86ec3e6a98a Mon Sep 17 00:00:00 2001 From: Luke Howell Date: Wed, 25 Apr 2018 01:22:34 -0500 Subject: [PATCH] docs(router-store): Grammatical and consistency fixes --- docs/router-store/README.md | 28 ++++++++++++++------------ docs/router-store/api.md | 40 ++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/docs/router-store/README.md b/docs/router-store/README.md index 0de71cf1e8..71d7f71a93 100644 --- a/docs/router-store/README.md +++ b/docs/router-store/README.md @@ -3,6 +3,7 @@ Bindings to connect the Angular Router with @ngrx/store ### Installation + Install @ngrx/router-store from npm: `npm install @ngrx/router-store --save` OR `yarn add @ngrx/router-store` @@ -33,11 +34,11 @@ export declare type RouterNavigationAction = { }; ``` -- Reducers receive this action. Throwing an error in the reducer cancels navigation. -- Effects can listen for this action. -- The `ROUTER_CANCEL` action represents a guard canceling navigation. -- A `ROUTER_ERROR` action represents a navigation error . -- `ROUTER_CANCEL` and `ROUTER_ERROR` contain the store state before the navigation. Use the previous state to restore the consistency of the store. +* Reducers receive this action, throwing an error in the reducer cancels navigation. +* Effects can listen for this action. +* The `ROUTER_CANCEL` action represents a guard canceling navigation. +* A `ROUTER_ERROR` action represents a navigation error . +* `ROUTER_CANCEL` and `ROUTER_ERROR` contain the store state before the navigation. Use the previous state to restore the consistency of the store. ## Setup @@ -49,21 +50,22 @@ import { AppComponent } from './app.component'; imports: [ BrowserModule, StoreModule.forRoot({ - router: routerReducer + router: routerReducer, }), RouterModule.forRoot([ // routes ]), StoreRouterConnectingModule.forRoot({ - stateKey: 'router' // name of reducer key - }) + stateKey: 'router', // name of reducer key + }), ], - bootstrap: [AppComponent] + bootstrap: [AppComponent], }) -export class AppModule { } +export class AppModule {} ``` ## API Documentation -- [Navigation actions](./api.md#navigation-actions) -- [Effects](./api.md#effects) -- [Custom Router State Serializer](./api.md#custom-router-state-serializer) + +* [Navigation actions](./api.md#navigation-actions) +* [Effects](./api.md#effects) +* [Custom Router State Serializer](./api.md#custom-router-state-serializer) diff --git a/docs/router-store/api.md b/docs/router-store/api.md index 6d7d9b8bb4..6bab049299 100644 --- a/docs/router-store/api.md +++ b/docs/router-store/api.md @@ -16,11 +16,13 @@ export const FORWARD = '[Router] Forward'; export class Go implements Action { readonly type = GO; - constructor(public payload: { - path: any[]; - query?: object; - extras?: NavigationExtras; - }) {} + constructor( + public payload: { + path: any[]; + query?: object; + extras?: NavigationExtras; + } + ) {} } export class Back implements Action { @@ -31,10 +33,7 @@ export class Forward implements Action { readonly type = FORWARD; } -export type RouterActionsUnion = - | Go - | Back - | Forward; +export type RouterActionsUnion = Go | Back | Forward; ``` ```ts @@ -67,9 +66,10 @@ export class RouterEffects { navigate$ = this.actions$.pipe( ofType(RouterActions.GO), map((action: RouterActions.Go) => action.payload), - tap(({ path, query: queryParams, extras}) - => this.router.navigate(path, { queryParams, ...extras })) - ) + tap(({ path, query: queryParams, extras }) => + this.router.navigate(path, { queryParams, ...extras }) + ) + ); @Effect({ dispatch: false }) navigateBack$ = this.actions$.pipe( @@ -98,7 +98,7 @@ issues when used with the Store Devtools. In most cases, you may only need a pie Additionally, the router state snapshot is a mutable object, which can cause issues when developing with [store freeze](https://github.com/brandonroberts/ngrx-store-freeze) to prevent direct state mutations. This can be avoided by using a custom serializer. -**NOTE**: To use the time-traveling debugging in the Devtools with router-store, you must return an object containing a `url` property when using the `routerReducer`. +**NOTE**: To use the time-travelling debugging in the Devtools with router-store, you must return an object containing a `url` property when using the `routerReducer`. ```ts import { StoreModule, ActionReducerMap } from '@ngrx/store'; @@ -107,7 +107,7 @@ import { StoreRouterConnectingModule, routerReducer, RouterReducerState, - RouterStateSerializer + RouterStateSerializer, } from '@ngrx/router-store'; export interface RouterStateUrl { @@ -138,7 +138,7 @@ export class CustomSerializer implements RouterStateSerializer { } export const reducers: ActionReducerMap = { - router: routerReducer + router: routerReducer, }; @NgModule({ @@ -148,12 +148,10 @@ export const reducers: ActionReducerMap = { // routes ]), StoreRouterConnectingModule.forRoot({ - stateKey: 'router' - }) + stateKey: 'router', + }), ], - providers: [ - { provide: RouterStateSerializer, useClass: CustomSerializer } - ] + providers: [{ provide: RouterStateSerializer, useClass: CustomSerializer }], }) -export class AppModule { } +export class AppModule {} ```