Close menu on navigation
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good

This commit is contained in:
Willem Dantuma 2020-01-27 17:28:17 +01:00
parent 252e920848
commit 0674b0ac7c
2 changed files with 5 additions and 9 deletions

View File

@ -1,5 +1,5 @@
import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener } from '@angular/core'; import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener } from '@angular/core';
import { Router, NavigationEnd, RouteConfigLoadStart, RouteConfigLoadEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router'; import { Router, NavigationStart, NavigationEnd, RouteConfigLoadStart, RouteConfigLoadEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router';
import { Meta, Title, MetaDefinition } from '@angular/platform-browser';import { DOCUMENT } from "@angular/common"; import { Meta, Title, MetaDefinition } from '@angular/platform-browser';import { DOCUMENT } from "@angular/common";
import { Subscription , Observable } from 'rxjs'; import { Subscription , Observable } from 'rxjs';
import { Store, Action } from '@ngrx/store'; import { Store, Action } from '@ngrx/store';
@ -117,6 +117,9 @@ export class AppComponent implements OnInit, OnDestroy {
if (event instanceof RouteConfigLoadEnd) { if (event instanceof RouteConfigLoadEnd) {
other.store.dispatch(new commonActions.EndRouteLoading()); other.store.dispatch(new commonActions.EndRouteLoading());
} }
if(event instanceof NavigationStart) {
other.store.dispatch(new commonActions.SetMenuVisible(false));
}
}); });
} }

View File

@ -101,14 +101,7 @@ export class AppCommonEffects {
} }
)); ));
@Effect()
closeMenuOnRouting$:Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.STARTROUTELOADING),
switchMap((action) => {
return of(new appCommonActions.SetMenuVisible(false));
}
));
@Effect({ dispatch: false }) @Effect({ dispatch: false })
fail$: Observable<Action> = this.actions$.pipe( fail$: Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.FAIL), ofType(appCommonActions.FAIL),