ui-router-navigation-location-plugin / NavigationLocationService
Class: NavigationLocationService
Defined in: index.ts:146
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.
The service intercepts the navigations it starts, so a router transition commits as a same-document navigation instead of loading the document afresh. An application's extra work on those navigations — view transitions, analytics, progress UI — goes through the intercept option.
See
https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API
Extends
Constructors
Constructor
new NavigationLocationService(router?, options?): NavigationLocationService;Defined in: index.ts:160
Creates a new NavigationLocationService instance.
Parameters
| Parameter | Type | Description |
|---|---|---|
router? | UIRouter | The UIRouter instance (required despite optional type signature) |
options? | NavigationLocationPluginOptions | How the service intercepts its own navigations |
Returns
NavigationLocationService
Throws
Error if router is not provided
Overrides
BaseLocationServices.constructorMethods
_navigation()
protected _navigation(): Navigation;Defined in: index.ts:290
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
class StubbedNavigationLocationService extends NavigationLocationService {
protected override _navigation(): Navigation {
return this.stub;
}
}dispose()
dispose(router): void;Defined in: index.ts:367
Cleans up the location service by removing its Navigation API listeners.
Parameters
| Parameter | Type | Description |
|---|---|---|
router | UIRouter | The UIRouter instance |
Returns
void
Overrides
BaseLocationServices.dispose