@angular/router#IsActiveMatchOptions TypeScript Examples
The following examples show how to use
@angular/router#IsActiveMatchOptions.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: tour.service.ts From ngx-ui-tour with MIT License | 7 votes |
private async navigateToRouteAndSetStep(step: T) {
const url = typeof step.route === 'string' ? step.route : this.router.createUrlTree(step.route),
matchOptions: IsActiveMatchOptions = {
paths: 'exact',
matrixParams: 'exact',
queryParams: 'subset',
fragment: 'ignored'
};
const isActive = this.router.isActive(url, matchOptions);
if (isActive) {
this.setCurrentStepAsync(step);
return;
}
const navigated = await this.router.navigateByUrl(url);
if (!navigated) {
console.warn('Navigation to route failed: ', step.route);
this.end();
} else {
this.setCurrentStepAsync(step, step.delayAfterNavigation);
}
}