Skip to content

ui-router-navigation-location-plugin / NavigationLocationService

Class: NavigationLocationService

Defined in: index.ts:73

Location service implementation using the Navigation API.

Uses the browser's Navigation API for URL management instead of the History API, providing better integration with browser navigation and enabling interception of navigation events.

See

https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API

Extends

Constructors

Constructor

ts
new NavigationLocationService(router?): NavigationLocationService;

Defined in: index.ts:83

Creates a new NavigationLocationService instance.

Parameters

ParameterTypeDescription
router?UIRouterThe UIRouter instance (required despite optional type signature)

Returns

NavigationLocationService

Throws

Error if router is not provided

Overrides

ts
BaseLocationServices.constructor

Properties

PropertyTypeDefined in
_configLocationConfigindex.ts:74

Methods

ts
protected _navigation(): Navigation;

Defined in: index.ts:113

The Navigation API object this service drives.

Single seam for every navigation touch point. Override in a subclass to substitute a stub — tests get to assert against the calls this service makes without booting a browser to spy on a global.

Returns

Navigation

Example

ts
class StubbedNavigationLocationService extends NavigationLocationService {
  protected override _navigation(): Navigation {
    return this.stub;
  }
}

dispose()

ts
dispose(router): void;

Defined in: index.ts:189

Cleans up the location service by removing the navigation event listener.

Parameters

ParameterTypeDescription
routerUIRouterThe UIRouter instance

Returns

void

Overrides

ts
BaseLocationServices.dispose