Skip to content

ui-router-server / simulate / createHeadlessRouter

Function: createHeadlessRouter() ​

ts
function createHeadlessRouter(states, config?): UIRouter;

Defined in: simulate.ts:17

Core's own headless recipe: vanilla $q/$injector plus an in-memory location need no DOM, so per-request instantiation is workerd-safe.

Registers a shallow copy of each declaration, so one array can back many concurrent routers. Inside a declaration's own functions (redirectTo, resolves, hooks), transition.to() and state.self are the copy, not the caller's object; compare states by name.

Parameters ​

ParameterType
statesreadonly StateDeclaration[]
config?RouterUrlConfig

Returns ​

UIRouter