Changeset View
Changeset View
Standalone View
Standalone View
src/app/app.component.ts
Show All 17 Lines | constructor( | ||||
private areaService: AreaService, | private areaService: AreaService, | ||||
private authenticationService: AuthenticationService, | private authenticationService: AuthenticationService, | ||||
private navBarService: NavBarService, | private navBarService: NavBarService, | ||||
angulartics2Piwik: Angulartics2Piwik | angulartics2Piwik: Angulartics2Piwik | ||||
) { | ) { | ||||
if (this.authenticationService.token) { | if (this.authenticationService.token) { | ||||
this.areaService.getAreas() | this.areaService.getAreas() | ||||
.takeUntil(this.componentDestroyed) | .takeUntil(this.componentDestroyed) | ||||
.subscribe(result => { | .subscribe(() => { | ||||
this.loading = false; | this.loading = false; | ||||
this.cdRef.detectChanges(); | this.cdRef.detectChanges(); | ||||
}); | }); | ||||
} else { | } else { | ||||
this.navBarService.areaVisible.next(false); | this.navBarService.areaVisible.next(false); | ||||
this.loading = false; | this.loading = false; | ||||
} | } | ||||
} | } | ||||
ngOnDestroy() { | ngOnDestroy() { | ||||
this.cdRef.detach(); | this.cdRef.detach(); | ||||
this.componentDestroyed.next(true); | this.componentDestroyed.next(true); | ||||
this.componentDestroyed.complete(); | this.componentDestroyed.complete(); | ||||
} | } | ||||
} | } |