lit-ui-router-effect / RouterRefController
Class: RouterRefController<T>
Defined in: router-ref-controller.ts:46
A RefController preselected on the router: follows the routeRef of the host's <ui-router> context.
class App extends LitElement {
private active = new RouterRefController(
this,
(route) => route.includes('admin.**'),
);
render() {
return html`...${this.active.value ? 'admin' : ''}...`;
}
}Same lifecycle as the base: seeded synchronously on every (re)connect, one forked fiber while connected, interrupted on disconnect. A host outside any <ui-router> (with no explicit router option) warns once in development and is a no-op until it reconnects under one; .value stays at options.initialValue.
Extends
RefController<readonly [SubscriptionRef.SubscriptionRef<RouteSnapshot>],T>
Type Parameters
| Type Parameter |
|---|
T |
Constructors
Constructor
new RouterRefController<T>(
host,
selector,
options?
): RouterRefController<T>;Defined in: router-ref-controller.ts:50
Parameters
| Parameter | Type |
|---|---|
host | ReactiveControllerHost & Element |
selector | (route) => T |
options | RouterRefControllerOptions<T> |
Returns
RouterRefController<T>
Overrides
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
value | T | The selected value, for use in render(). | RefController.value | ref-controller.ts:105 |
Methods
hostConnected()
hostConnected(): void;Defined in: ref-controller.ts:127
Called when the host is connected to the component tree. For custom element hosts, this corresponds to the connectedCallback() lifecycle, which is only called when the component is connected to the document.
Returns
void
Inherited from
hostDisconnected()
hostDisconnected(): void;Defined in: ref-controller.ts:140
Called when the host is disconnected from the component tree. For custom element hosts, this corresponds to the disconnectedCallback() lifecycle, which is called the host or an ancestor component is disconnected from the document.
Returns
void