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

Method $$parse

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

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