## Index

### Classes

- BaseLocationServices
- BrowserLocationConfig
- HashLocationService
- MemoryLocationConfig
- MemoryLocationService
- PushStateLocationService

### Interfaces

- HistoryLike
- LocationLike
- LocationPlugin
- ServicesPlugin

### Variables

- $injector
- $q
- ARGUMENT_NAMES
- STRIP_COMMENTS
- globals
- hashLocationPlugin
- memoryLocationPlugin
- pushStateLocationPlugin

### Functions

- buildUrl
- getParams
- keyValsToObjectR
- locationPluginFactory
- parseUrl
- servicesPlugin

## Variables

$injector: any = {/** Gets an object from DI based on a string token */get: name => globals[name],/** Returns true if an object named `name` exists in global DI */has: (name) => $injector.get(name) != null,/*** Injects a function** @param fn the function to inject* @param context the function's `this` binding* @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }`*/invoke: (fn: IInjectable, context?, locals?) => {const all = extend({}, globals, locals || {});const params = $injector.annotate(fn);const ensureExist = assertPredicate((key: string) => all.hasOwnProperty(key), key => `DI can't find injectable: '${key}'`);const args = params.filter(ensureExist).map(x => all[x]);if (isFunction(fn)) return fn.apply(context, args);else return (fn as any[]).slice(-1)[0].apply(context, args);},/*** Returns a function's dependencies** Analyzes a function (or array) and returns an array of DI tokens that the function requires.* @return an array of `string`s*/annotate: (fn: IInjectable): any[] => {if (!isInjectable(fn)) throw new Error(`Not an injectable function: ${fn}`);if (fn && (fn as any).$inject) return (fn as any).$inject;if (isArray(fn)) return fn.slice(0, -1);const fnStr = fn.toString().replace(STRIP_COMMENTS, '');const result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES);return result || [];},} as $InjectorLike

A basic angular1-like injector api

A basic angular1-like injector api

This object implements four methods similar to the angular 1 dependency injector

UI-Router evolved from an angular 1 library to a framework agnostic library. However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.

This object provides a naive implementation of a globally scoped dependency injection system. It supports the following DI approaches:

### Function parameter names

A function's `.toString()` is called, and the parameter names are parsed. This only works when the parameter names aren't "mangled" by a minifier such as UglifyJS.

    function injectedFunction(FooService, BarService) {
      // FooService and BarService are injected
    }

### Function annotation

A function may be annotated with an array of dependency names as the `$inject` property.

    injectedFunction.$inject = [ 'FooService', 'BarService' ];
    function injectedFunction(fs, bs) {
      // FooService and BarService are injected as fs and bs parameters
    }

### Array notation

An array provides the names of the dependencies to inject (as strings). The function is the last element of the array.

    [ 'FooService', 'BarService', function (fs, bs) {
      // FooService and BarService are injected as fs and bs parameters
    }]

type

  {$InjectorLike}

- Defined in vanilla/injector.ts:62

$q: $QLike = {/** Normalizes a value as a promise */when: (val) => new Promise((resolve, reject) => resolve(val)),/** Normalizes a value as a promise rejection */reject: (val) => new Promise((resolve, reject) => { reject(val); }),/** @returns a deferred object, which has `resolve` and `reject` functions */defer: () => {const deferred: any = {};deferred.promise = new Promise((resolve, reject) => {deferred.resolve = resolve;deferred.reject = reject;});return deferred;},/** Like Promise.all(), but also supports object key/promise notation like $q */all: (promises: { [key: string]: Promise<any> } | Promise<any>[]) => {if (isArray(promises)) {return Promise.all(promises);}if (isObject(promises)) {// Convert promises map to promises array.// When each promise resolves, map it to a tuple { key: key, val: val }const chain = Object.keys(promises).map(key => promises[key].then(val => ({ key, val })));// Then wait for all promises to resolve, and convert them back to an objectreturn $q.all(chain).then(values =>values.reduce((acc, tuple) => { acc[tuple.key] = tuple.val; return acc; }, {}));}},} as $QLike

An angular1-like promise api

An angular1-like promise api

This object implements four methods similar to the angular 1 promise api

UI-Router evolved from an angular 1 library to a framework agnostic library. However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.

This API provides native ES6 promise support wrapped as a $q-like API. Internally, UI-Router uses this $q object to perform promise operations. The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular.

$q-like promise api

- Defined in vanilla/q.ts:23

ARGUMENT_NAMES: RegExp = /([^\s,]+)/g

- Defined in vanilla/injector.ts:13

STRIP_COMMENTS: RegExp = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg

- Defined in vanilla/injector.ts:12

globals: object

#### Type declaration

- Defined in vanilla/injector.ts:11

hashLocationPlugin: function = locationPluginFactory('vanilla.hashBangLocation', false, HashLocationService, BrowserLocationConfig)

A `UIRouterPlugin` uses the browser hash to get/set the current location

A `UIRouterPlugin` uses the browser hash to get/set the current location

#### Type declaration

- - (router: UIRouter): LocationPlugin

  - #### Parameters

    - ##### router UIRouter

    #### Returns LocationPlugin

- Defined in vanilla/plugins.ts:26

memoryLocationPlugin: function = locationPluginFactory('vanilla.memoryLocation', false, MemoryLocationService, MemoryLocationConfig)

A `UIRouterPlugin` that gets/sets the current location from an in-memory object

A `UIRouterPlugin` that gets/sets the current location from an in-memory object

#### Type declaration

- - (router: UIRouter): LocationPlugin

  - #### Parameters

    - ##### router UIRouter

    #### Returns LocationPlugin

- Defined in vanilla/plugins.ts:34

pushStateLocationPlugin: function = locationPluginFactory('vanilla.pushStateLocation', true, PushStateLocationService, BrowserLocationConfig)

A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis

A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis

#### Type declaration

- - (router: UIRouter): LocationPlugin

  - #### Parameters

    - ##### router UIRouter

    #### Returns LocationPlugin

- Defined in vanilla/plugins.ts:30

## Functions

- buildUrl(loc: LocationServices): string

- #### Parameters

  - ##### loc LocationServices

  #### Returns string

  - Defined in vanilla/utils.ts:33

- getParams(queryString: string): any

- #### Parameters

  - ##### queryString string

  #### Returns any

  - Defined in vanilla/utils.ts:22

- keyValsToObjectR(accum: any, __namedParameters: [any, any]): any

- #### Parameters

  - ##### accum any

  - ##### __namedParameters [any, any]

  #### Returns any

  - Defined in vanilla/utils.ts:11

- locationPluginFactory(name: string, isHtml5: boolean, serviceClass: object, configurationClass: object): (Anonymous function)

- #### Parameters

  - ##### name string

  - ##### isHtml5 boolean

  - ##### serviceClass object

    - ##### constructor: function

      - new __type(uiRouter?: UIRouter): LocationServices

      - #### Parameters

        - ##### uiRouter: Optional UIRouter

        #### Returns LocationServices

        - Defined in vanilla/utils.ts:50

  - ##### configurationClass object

    - ##### constructor: function

      - new __type(uiRouter?: UIRouter, isHtml5?: boolean): LocationConfig

      - #### Parameters

        - ##### uiRouter: Optional UIRouter

        - ##### isHtml5: Optional boolean

        #### Returns LocationConfig

        - Defined in vanilla/utils.ts:51

  #### Returns (Anonymous function)

  - Defined in vanilla/utils.ts:47

- parseUrl(url: string): object

- #### Parameters

  - ##### url string

  #### Returns object

  - ##### hash: any

  - ##### path: any

  - ##### search: any

  - ##### url: string

  - Defined in vanilla/utils.ts:25

- servicesPlugin(router: UIRouter): ServicesPlugin

- #### Parameters

  - ##### router UIRouter

  #### Returns ServicesPlugin

  - Defined in vanilla/plugins.ts:18

Generated using TypeDoc