forked from onecx/onecx-theme-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixed label resolver implementation and adjusted tests
- Loading branch information
Showing
2 changed files
with
13 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
import { Injectable } from '@angular/core' | ||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router' | ||
import { TranslateService } from '@ngx-translate/core' | ||
import { Observable } from 'rxjs' | ||
import { Observable, map } from 'rxjs' | ||
|
||
//dont use `providedIn root` - wont work when we are in shell | ||
@Injectable() | ||
export class LabelResolver implements Resolve<string> { | ||
constructor(private translate: TranslateService) {} | ||
resolve(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot): string | Observable<string> | Promise<string> { | ||
return route.data['breadcrumb'] ? this.translate.instant(route.data['breadcrumb']) : route.routeConfig?.path | ||
/* TODO: use this if tests are running with it. | ||
resolve(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot): string | Observable<string> | Promise<string> { | ||
return route.data['breadcrumb'] | ||
? this.translate.get(route.data['breadcrumb']).pipe(map((t) => t.toString())) | ||
: route.routeConfig?.path ?? '' | ||
*/ | ||
} | ||
} |