Updated ngrx to 6.0.0-beta.1

This commit is contained in:
Sercan Yemen 2018-05-09 14:50:30 +03:00
parent a2187e0134
commit 6bf2fe0b17
5 changed files with 3351 additions and 3299 deletions

6505
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,22 +20,22 @@
"dependencies": {
"@agm/core": "1.0.0-beta.2",
"@angular/animations": "6.0.0",
"@angular/cdk": "6.0.0",
"@angular/cdk": "6.0.1",
"@angular/common": "6.0.0",
"@angular/compiler": "6.0.0",
"@angular/core": "6.0.0",
"@angular/flex-layout": "6.0.0-beta.15",
"@angular/forms": "6.0.0",
"@angular/http": "6.0.0",
"@angular/material": "6.0.0",
"@angular/material-moment-adapter": "6.0.0",
"@angular/material": "6.0.1",
"@angular/material-moment-adapter": "6.0.1",
"@angular/platform-browser": "6.0.0",
"@angular/platform-browser-dynamic": "6.0.0",
"@angular/router": "6.0.0",
"@ngrx/effects": "5.2.0",
"@ngrx/router-store": "5.2.0",
"@ngrx/store": "5.2.0",
"@ngrx/store-devtools": "5.2.0",
"@ngrx/effects": "6.0.0-beta.1",
"@ngrx/router-store": "6.0.0-beta.1",
"@ngrx/store": "6.0.0-beta.1",
"@ngrx/store-devtools": "6.0.0-beta.1",
"@ngx-translate/core": "10.0.1",
"@swimlane/ngx-charts": "7.3.0",
"@swimlane/ngx-datatable": "11.3.2",

View File

@ -5,22 +5,28 @@ export const GO = '[Router] Go';
export const BACK = '[Router] Back';
export const FORWARD = '[Router] Forward';
export class Go implements Action {
export class Go implements Action
{
readonly type = GO;
constructor(
public payload: {
path: any[];
query?: object;
extras?: NavigationExtras;
}
) {}
)
{
}
}
export class Back implements Action {
export class Back implements Action
{
readonly type = BACK;
}
export class Forward implements Action {
export class Forward implements Action
{
readonly type = FORWARD;
}

View File

@ -8,12 +8,15 @@ import * as RouterActions from '../actions/router.action';
import { tap, map } from 'rxjs/operators';
@Injectable()
export class RouterEffects {
export class RouterEffects
{
constructor(
private actions$: Actions,
private router: Router,
private location: Location
) {}
)
{
}
@Effect({dispatch: false})
navigate$ = this.actions$.ofType(RouterActions.GO).pipe(

View File

@ -1,42 +1,48 @@
import {
ActivatedRouteSnapshot,
RouterStateSnapshot,
Params,
Params
} from '@angular/router';
import { createFeatureSelector, ActionReducerMap } from '@ngrx/store';
import * as fromRouter from '@ngrx/router-store';
export interface RouterStateUrl {
export interface RouterStateUrl
{
url: string;
queryParams: Params;
params: Params;
}
export interface State {
export interface State
{
routerReducer: fromRouter.RouterReducerState<RouterStateUrl>;
}
export const reducers: ActionReducerMap<State> = {
routerReducer: fromRouter.routerReducer,
routerReducer: fromRouter.routerReducer
};
export const getRouterState = createFeatureSelector<
fromRouter.RouterReducerState<RouterStateUrl>
>('routerReducer');
export const getRouterState = createFeatureSelector<fromRouter.RouterReducerState<RouterStateUrl>>('routerReducer');
export class CustomSerializer
implements fromRouter.RouterStateSerializer<RouterStateUrl> {
serialize(routerState: RouterStateSnapshot): RouterStateUrl {
export class CustomSerializer implements fromRouter.RouterStateSerializer<RouterStateUrl>
{
serialize(routerState: RouterStateSnapshot): RouterStateUrl
{
const {url} = routerState;
const {queryParams} = routerState.root;
let state: ActivatedRouteSnapshot = routerState.root;
while (state.firstChild) {
while ( state.firstChild )
{
state = state.firstChild;
}
const {params} = state;
return { url, queryParams, params };
return {
url,
queryParams,
params
};
}
}