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

Method $$parse

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

* Parses the provided URL, and sets the current URL to the parsed result. * * @param url The URL string.

(url: string)

Source from the content-addressed store, hash-verified

418 * @param url The URL string.
419 */
420 $$parse(url: string) {
421 let pathUrl: string | undefined;
422 if (url.startsWith('/')) {
423 pathUrl = url;
424 } else {
425 // Remove protocol & hostname if URL starts with it
426 pathUrl = this.stripBaseUrl(this.getServerBase(), url);
427 }
428 if (typeof pathUrl === 'undefined') {
429 throw new Error(`Invalid url "${url}", missing path prefix "${this.getServerBase()}".`);
430 }
431
432 this.parseAppUrl(pathUrl);
433
434 this.$$path ||= '/';
435 this.composeUrls();
436 }
437
438 /**
439 * Parses the provided URL and its relative URL.

Callers 3

initializeMethod · 0.95
$$parseLinkUrlMethod · 0.95
upgrade.spec.tsFile · 0.80

Calls 4

stripBaseUrlMethod · 0.95
getServerBaseMethod · 0.95
parseAppUrlMethod · 0.95
composeUrlsMethod · 0.95

Tested by

no test coverage detected