Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed first navigation crash to results pages #4332

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
//
////////////////////////////////
import { Component, OnInit } from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';
import { ActivatedRoute } from '@angular/router';
import { ConfigService } from '../../../../services/config.service';
import { MaturityService } from '../../../../services/maturity.service';
import { filter } from 'rxjs/operators';


/**
Expand All @@ -42,7 +41,7 @@ export class CrrResultsPage implements OnInit {
public domain: any;
public loaded = false;

public pageName = "";
public pageName: string = "";
public domainAbbrev = "";
public domainName;

Expand All @@ -57,18 +56,17 @@ export class CrrResultsPage implements OnInit {
constructor(
private maturitySvc: MaturityService,
public configSvc: ConfigService,
private router: Router
public activatedRoute: ActivatedRoute
) {
this.router.events.pipe(
filter(event => event instanceof NavigationEnd)
).subscribe((e: any) => {
var url: string = e.url;
var slash = url.lastIndexOf('/');
this.pageName = url.substr(slash + 1);
this.domainAbbrev = this.pageName.substr(this.pageName.indexOf('crr-domain-') + 11).toUpperCase();
});
this.manualNav();
}
/**
* We are reusing crr results component for multiple routes and must handle routing manually.
*/
manualNav(): void {
this.pageName = this.activatedRoute.snapshot.url.join('/');
this.domainAbbrev = this.pageName.substring(this.pageName.indexOf('crr-domain-') + 11).toUpperCase();
}


/**
*
Expand Down
Loading