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

Method url

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

Source from the content-addressed store, hash-verified

515 url(): string;
516 url(url: string): this;
517 url(url?: string): string | this {
518 if (typeof url === 'string') {
519 if (!url.length) {
520 url = '/';
521 }
522
523 const match = PATH_MATCH.exec(url);
524 if (!match) return this;
525 if (match[1] || url === '') this.path(this.urlCodec.decodePath(match[1]));
526 if (match[2] || match[1] || url === '') this.search(match[3] || '');
527 this.hash(match[5] || '');
528
529 // Chainable method
530 return this;
531 }
532
533 return this.$$url;
534 }
535
536 /**
537 * 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