class
A codec for encoding and decoding URL parts.
abstract class UrlCodec { abstract encodePath(path: string): string abstract decodePath(path: string): string abstract encodeSearch(search: string | { [k: string]: unknown; }): string abstract decodeSearch(search: string): {...} abstract encodeHash(hash: string): string abstract decodeHash(hash: string): string abstract normalize(href: string): string abstract areEqual(valA: string, valB: string): boolean abstract parse(url: string, base?: string): {...} }
encodePath() | |||
---|---|---|---|
Encodes the path from the provided string | |||
|
path | string | The path string |
string
decodePath() | |||
---|---|---|---|
Decodes the path from the provided string | |||
|
path | string | The path string |
string
encodeSearch() | |||
---|---|---|---|
Encodes the search string from the provided string or object | |||
|
search | string | { [k: string]: unknown; } |
string
decodeSearch() | |||
---|---|---|---|
Decodes the search objects from the provided string | |||
|
search | string |
`{
}`
encodeHash() | |||
---|---|---|---|
Encodes the hash from the provided string | |||
|
hash | string |
string
decodeHash() | |||
---|---|---|---|
Decodes the hash from the provided string | |||
|
hash | string |
string
normalize() | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Normalizes the URL from the provided string | ||||||||||||
|
href | string |
string
Normalizes the URL from the provided string, search, hash, and base URL parameters
abstract normalize(path: string, search: { [k: string]: unknown; }, hash: string, baseUrl?: string): string
path | string | The URL path |
search | object | The search object |
hash | string | The has string |
baseUrl | string | The base URL for the URL Optional. Default is |
string
areEqual() | ||||||
---|---|---|---|---|---|---|
Checks whether the two strings are equal | ||||||
|
valA | string | First string for comparison |
valB | string | Second string for comparison |
boolean
parse() | ||||||
---|---|---|---|---|---|---|
Parses the URL string based on the base URL | ||||||
|
url | string | The full URL string |
base | string | The base for the URL Optional. Default is |
{ href: string; protocol: string; host: string; search: string; hash: string; hostname: string; port: string; pathname: string; }
© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v12.angular.io/api/common/upgrade/UrlCodec