MCPcopy Create free account
hub / github.com/angular/angular / url

Method url

packages/common/upgrade/src/location_shim.ts:519–536  ·  view source on GitHub ↗
(url?: string)

Source from the content-addressed store, hash-verified

517 url(): string;
518 url(url: string): this;
519 url(url?: string): string | this {
520 if (typeof url === 'string') {
521 if (!url.length) {
522 url = '/';
523 }
524
525 const match = PATH_MATCH.exec(url);
526 if (!match) return this;
527 if (match[1] || url === '') this.path(this.urlCodec.decodePath(match[1]));
528 if (match[2] || match[1] || url === '') this.search(match[3] || '');
529 this.hash(match[5] || '');
530
531 // Chainable method
532 return this;
533 }
534
535 return this.$$url;
536 }
537
538 /**
539 * Retrieves the protocol of the current URL.

Callers 4

initializeMethod · 0.95
upgrade.spec.tsFile · 0.45
setupUrlFunction · 0.45

Calls 4

pathMethod · 0.95
searchMethod · 0.95
hashMethod · 0.95
decodePathMethod · 0.80

Tested by 1

setupUrlFunction · 0.36