Skip to main content
zerotal

Documentation


Documentation / @zerotal/flow / index / url

Function: url()

Call Signature

url(value, context): void

Defined in: flow/src/decorators.ts:831

Syncs a field to the browser URL query string, so its value is reflected in and restored from the URL.

Parameters

value

unknown

context

ClassFieldDecoratorContext

Returns

void

When configured, a field decorator; when used bare, nothing (applied directly).

Remarks

Usable bare as @url (no parens) or configured as @url({ as: 'page', history: 'push' }) — see UrlOptions. By default the query parameter takes the property's name and updates replace the current history entry.

A URL-synced field is client-visible by definition, so @url implies @expose — no need to write both. Add @locked for a value the client reads but the server owns. Applies to a field.

Example

class ProductList extends Component {
  @url page = 1;
  @url({ as: "q", history: "push" }) search = "";
}

Call Signature

url(opts?): UrlDecorator

Defined in: flow/src/decorators.ts:832

Syncs a field to the browser URL query string, so its value is reflected in and restored from the URL.

Parameters

opts?

UrlOptions

Optional UrlOptions when called with parentheses.

Returns

UrlDecorator

When configured, a field decorator; when used bare, nothing (applied directly).

Remarks

Usable bare as @url (no parens) or configured as @url({ as: 'page', history: 'push' }) — see UrlOptions. By default the query parameter takes the property's name and updates replace the current history entry.

A URL-synced field is client-visible by definition, so @url implies @expose — no need to write both. Add @locked for a value the client reads but the server owns. Applies to a field.

Example

class ProductList extends Component {
  @url page = 1;
  @url({ as: "q", history: "push" }) search = "";
}