MCPcopy Index your code
hub / github.com/angular/angular / constructor

Method constructor

packages/common/src/location/location.ts:67–85  ·  view source on GitHub ↗
(locationStrategy: LocationStrategy)

Source from the content-addressed store, hash-verified

65 _urlChangeSubscription: SubscriptionLike | null = null;
66
67 constructor(locationStrategy: LocationStrategy) {
68 this._locationStrategy = locationStrategy;
69 const baseHref = this._locationStrategy.getBaseHref();
70 // Note: This class's interaction with base HREF does not fully follow the rules
71 // outlined in the spec https://www.freesoft.org/CIE/RFC/1808/18.htm.
72 // Instead of trying to fix individual bugs with more and more code, we should
73 // investigate using the URL constructor and providing the base as a second
74 // argument.
75 // https://developer.mozilla.org/en-US/docs/Web/API/URL/URL#parameters
76 this._basePath = _stripOrigin(stripTrailingSlash(_stripIndexHtml(baseHref)));
77 this._locationStrategy.onPopState((ev) => {
78 this._subject.next({
79 'url': this.path(true),
80 'pop': true,
81 'state': ev.state,
82 'type': ev.type,
83 });
84 });
85 }
86
87 /** @docs-private */
88 ngOnDestroy(): void {

Callers

nothing calls this directly

Implementers 1

SpyLocationpackages/common/testing/src/location_m

Calls 7

pathMethod · 0.95
stripTrailingSlashFunction · 0.90
_stripOriginFunction · 0.85
_stripIndexHtmlFunction · 0.70
getBaseHrefMethod · 0.45
onPopStateMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected