MCPcopy Create free account
hub / github.com/angular/angular / $$parseLinkUrl

Method $$parseLinkUrl

packages/common/upgrade/src/location_shim.ts:444–462  ·  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

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