Skip to content

matchCurrent

matchCurrent(target): boolean

Defined in: route.ts:205

Returns true if the current route matches target.

Path must match exactly. Any search params specified in target must be present in the current URL, but extra params in the current URL are allowed.

Reactive: only reevaluates when the path changes to/from the target path, and when target k/v search pairs are (un)set.

Primary usage: ‘active’ status for menu items.

RouteTarget

boolean

// This example assumes interceptLinks() has been called
A('a.my-button text=Users href=/users .is-active=', route.matchCurrent('/users'));
// Alternatively a route object can be given
route.matchCurrent({path: '/users', search: {tab: 'profile'}});