MCPcopy
hub / github.com/angular/angular / $$parseLinkUrl

Method $$parseLinkUrl

packages/common/upgrade/src/location_shim.ts:446–464  ·  view source on GitHub ↗

* Parses the provided URL and its relative URL. * * @param url The full URL string. * @param relHref A URL string relative to the full URL string.

(url: string, relHref?: string | null)

Source from the content-addressed store, hash-verified

444 * @param relHref A URL string relative to the full URL string.
445 */
446 $$parseLinkUrl(url: string, relHref?: string | null): boolean {
447 // When relHref is passed, it should be a hash and is handled separately
448 if (relHref && relHref[0] === '#') {
449 this.hash(relHref.slice(1));
450 return true;
451 }
452 let rewrittenUrl;
453 let appUrl = this.stripBaseUrl(this.getServerBase(), url);
454 if (typeof appUrl !== 'undefined') {
455 rewrittenUrl = this.getServerBase() + appUrl;
456 } else if (this.getServerBase() === url + '/') {
457 rewrittenUrl = this.getServerBase();
458 }
459 // Set the URL
460 if (rewrittenUrl) {
461 this.$$parse(rewrittenUrl);
462 }
463 return !!rewrittenUrl;
464 }
465
466 private setBrowserUrlWithFallback(url: string, replace: boolean, state: unknown) {
467 const oldUrl = this.url();

Callers 4

constructorMethod · 0.95
initializeMethod · 0.95
upgrade.spec.tsFile · 0.80
parseLinkAndReturnFunction · 0.80

Calls 4

hashMethod · 0.95
stripBaseUrlMethod · 0.95
getServerBaseMethod · 0.95
$$parseMethod · 0.95

Tested by 1

parseLinkAndReturnFunction · 0.64