Skip to content
Ron Buckton edited this page Jan 15, 2015 · 2 revisions

Represents a URI or URL.

Syntax

export class Uri {
  constructor(uri: string);
  constructor(baseUri: string | Uri, uri: string | Uri);
  public protocol: string;
  public hostname: string;
  public port: number;
  public pathname: string;
  public search: string;
  public hash: string;
  public absolute: boolean;
  public scheme: string;
  public host: string;
  public static parse(uri: string): Uri;
  public static combine(baseUri: string | Uri, uri: string | Uri): Uri;
  public isSameOrigin(uri: string | Uri): boolean;
  public toString(): string;
}

Constructors

new Uri(String)
Creates a new Uri for the provided uri text.
new Uri(String|Uri,String|Uri)
Creates a new Uri relative to the provided uri.

Properties

origin
Gets the origin of the Uri
scheme
Gets the scheme for the uri (e.g. 'http://'')
protocol
The protocol for the Uri (e.g. 'http')
host
Gets the host for the uri, including the hostname and port
hostname
The hostname for the Uri
port
The port number for the Uri
pathname
The path name for the Uri
search
The search portion of the path, also known as the querystring
hash
The fragment portion of the path
isAbsolute
Gets a value indicating whether the Uri is an absolute url

Methods

static parse(String)
Parses the provided uri string
static combine(String|Uri,String|Uri)
Combines two uris
isSameOrigin(String|Uri)
Determines whether the provided Uri has the same origin as this Uri
toString()
Gets the string representation of the Uri

Requirements

  • Supported Platforms: Browser
  • Module: httpclient
  • Library: httpclient.ts