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.
Parameters
Section titled “Parameters”target
Section titled “target”RouteTarget
Returns
Section titled “Returns”boolean
Example
Section titled “Example”// This example assumes interceptLinks() has been calledA('a.my-button text=Users href=/users .is-active=', route.matchCurrent('/users'));
// Alternatively a route object can be givenroute.matchCurrent({path: '/users', search: {tab: 'profile'}});