LocationServices | ui-router-ng2
Options
Menu

Interface LocationServices

Hierarchy

Implemented by

Index

Methods

  • dispose(router?: UIRouter): any
  • Instructs the Disposable to clean up any resources

  • hash(): string
  • Gets the hash part of the current url

  • onChange(callback: Function): Function
  • Registers a url change handler

  • Registers a url change handler

    Example:

    let deregisterFn = locationServices.onChange((evt) => console.log("url change", evt));
    

    Parameters

    • callback Function
      :

      a function that will be called when the url is changing

    Returns Function

    :

    a function that de-registers the callback


  • path(): string
  • Gets the path part of the current url

  • search(): object
  • Gets the search part of the current url as an object

  • Gets the search part of the current url as an object

    If the current URL is /some/path?query=value#anchor, this returns { query: 'value' }

    Returns object

    :

    the search (querystring) portion of the url, as an object

    • [key: string]: any

  • url(): string
  • Gets the current url string

  • url(newurl: string, replace?: boolean, state?: any): string
  • Updates the url, or gets the current url

  • Gets the current url string

    Example:

    locationServices.url(); // "/some/path?query=value#anchor"
    

    Returns string

    :

    the current value of the url, as a string.


  • Updates the url, or gets the current url

    Updates the url, changing it to the value in newurl

    Example:

    locationServices.url("/some/path?query=value#anchor", true);
    

    Parameters

    • newurl string
      :

      The new value for the URL

    • replace: Optional  boolean
      :

      When true, replaces the current history entry (instead of appending it) with this new url

    • state: Optional  any
      :

      The history's state object, i.e., pushState (if the LocationServices implementation supports it)

    Returns string

    :

    the url (after potentially being processed)


Generated using TypeDoc