
Previously, the path returned by `LocationService.path()` preserved leading slashes, which resulted in requests with consequtive slashes in the URL. Such requests would fail (with a 404) on staging. This commit fixes it, by removing leading slashes from the path. It also refactors `LocationService` a bit, converting path to an observable, `currentPath` (similar to `currentUrl`), and applies certain clean-ups (e.g. stripping slashes, query, hash) in one place, which simplifies consumption. Closes #16230
16 lines
419 B
TypeScript
16 lines
419 B
TypeScript
/* tslint:disable component-selector */
|
|
import { Component } from '@angular/core';
|
|
import { LocationService } from 'app/shared/location.service';
|
|
|
|
/**
|
|
* A simple embedded component that displays the current location path
|
|
*/
|
|
@Component({
|
|
selector: 'current-location',
|
|
template: '{{ location.currentPath | async }}'
|
|
})
|
|
export class CurrentLocationComponent {
|
|
constructor(public location: LocationService) {
|
|
}
|
|
}
|