mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
All components, directives and pipes will now use standalone as default. Non-standalone decorators have now `standalone: false`. PR Close #58160
31 lines
881 B
TypeScript
31 lines
881 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.dev/license
|
|
*/
|
|
|
|
// #docregion LocationComponent
|
|
import {Location, LocationStrategy, PathLocationStrategy} from '@angular/common';
|
|
import {Component} from '@angular/core';
|
|
|
|
@Component({
|
|
selector: 'path-location',
|
|
providers: [Location, {provide: LocationStrategy, useClass: PathLocationStrategy}],
|
|
template: `
|
|
<h1>PathLocationStrategy</h1>
|
|
Current URL is: <code>{{ location.path() }}</code
|
|
><br />
|
|
Normalize: <code>/foo/bar/</code> is: <code>{{ location.normalize('foo/bar') }}</code
|
|
><br />
|
|
`,
|
|
standalone: false,
|
|
})
|
|
export class PathLocationComponent {
|
|
location: Location;
|
|
constructor(location: Location) {
|
|
this.location = location;
|
|
}
|
|
}
|
|
// #enddocregion
|