fix: Sidans titel ändras nu korrekt när man går tillbaka till startsidan. (TV-643)
Squashed commit of the following: commit b70383f449eb2e17e0da2e479316c821cdf4bb85 Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Sep 22 15:04:38 2021 +0200 fix: Flyttade titlesättning från layout.component till app.component. Krävde mer logik för att hitta vilken route man är på. (TV-643)
This commit is contained in:
@@ -40,17 +40,13 @@ export class LayoutComponent extends UnsubscribeDirective {
|
||||
private router: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private authenticationService: AuthenticationService,
|
||||
private userService: UserService,
|
||||
private titleService: Title
|
||||
private userService: UserService
|
||||
) {
|
||||
super();
|
||||
super.unsubscribeOnDestroy(
|
||||
this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(() => {
|
||||
const pageTitle = this.activatedRoute?.snapshot?.data?.title as string;
|
||||
const urlTree = this.router.parseUrl(this.router.url);
|
||||
|
||||
this.titleService.setTitle(`${pageTitle ? `${pageTitle} - ` : ''}Mina sidor för fristående aktörer`);
|
||||
|
||||
if (urlTree.queryParams.code) {
|
||||
void this.router.navigate([], {
|
||||
relativeTo: this.activatedRoute,
|
||||
|
||||
Reference in New Issue
Block a user