Skip to content

Commit

Permalink
Merge pull request #4332 from cisagov/bug/CSET-2940
Browse files Browse the repository at this point in the history
Fixed first navigation crash to results pages
  • Loading branch information
jekuipers authored Jan 9, 2025
2 parents ce6c987 + 15c23fa commit 2d1910e
Showing 1 changed file with 11 additions and 13 deletions.
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

0 comments on commit 2d1910e

Please sign in to comment.