Router

Router

Class representing a static base router

Constructor

new Router()

Source:

Members

(static) _routes :Array

Routes array

.

Source:

Routes array

Type:
  • Array

(static) triggers :Hooks

Hooks

.

Source:

Hooks

Type:
  • Hooks

_initialized :Boolean

Router initialization state

.

Source:

Router initialization state

Type:
  • Boolean

activeClassName :String

Active classname for active routes

.

Source:

Active classname for active routes

Type:
  • String

history :history

history

.

Source:

history

Type:
  • history

Hooks :Hooks

Hooks

.

Source:

Hooks

Type:
  • Hooks

routes :Array

Registered route definitions

.

Source:

Registered route definitions

Type:
  • Array

Methods

(static) current() → {Object}

Get the current route date.

Source:

Get the current route date. Not reactive.

Returns:

Object containing route data

Type
Object

(static) getParam(name) → {String|undefined}

Get param by name.

Source:

Get param by name. Is reactive.

Parameters:
Name Type Description
name String

Param name

Returns:

String value or undefined

Type
String | undefined

(static) getQueryParam(name) → {String|undefined}

Get query param by name

.

Source:

Get query param by name

Parameters:
Name Type Description
name String

Query param name. Is reactive.

Returns:

String value or undefined

Type
String | undefined

(static) getRouteName() → {String}

Get the name of the current route.

Source:

Get the name of the current route. Is reactive.

Returns:

Name of current route

Type
String

(static) go(path, params, query) → {undefined}

Navigate to path with params and query

.

Source:

Navigate to path with params and query

Parameters:
Name Type Description
path String

Path string

params Object

Route params object

query Object

Query params object

Returns:

undefined

Type
undefined

(static) initPackageRoutes(options) → {undefined}

initPackageRoutes registers route and template when registry item has registryItem.route && registryItem.template

.

Source:

initPackageRoutes registers route and template when registry item has registryItem.route && registryItem.template

Parameters:
Name Type Description
options Object

options and context for route creation

Returns:

returns undefined

Type
undefined

(static) isActiveClassName(routeName) → {String}

general helper to return "active" when on current path

Source:

isActive

Example
{{active "name"}}
Parameters:
Name Type Description
routeName String

route name as defined in registry

Returns:

return "active" or null

Type
String

(static) MetaData(context)

Populates title and meta tags for routes accepts Router.current() as context

Source:
Example
MetaData.init(Router.current());
Parameters:
Name Type Description
context

(static) pathFor(path, options) → {String}

get current router path

Source:
Parameters:
Name Type Description
path String

path to fetch

options Object

url params

Returns:

returns current router path

Type
String

(static) ready() → {Boolean}

Triggers reactively on router ready state changed

.

Source:

Triggers reactively on router ready state changed

Returns:

Router initialization state

Type
Boolean

(static) reload() → {undefined}

Reload router

.

Source:

Reload router

Returns:

undefined

Type
undefined

(static) replace(path, params, query) → {undefined}

Replace location

.

Source:

Replace location

Parameters:
Name Type Description
path String

Path string

params Object

Route params object

query Object

Query params object

Returns:

undefined

Type
undefined

(static) setCurrentRoute(routeData) → {undefined}

Set current route data.

Source:

Set current route data. Is reactive.

Parameters:
Name Type Description
routeData Object

Object containing route data

Returns:
Type
undefined

(static) setQueryParams(newParams) → {undefined}

Merge new query params with current params

.

Source:

Merge new query params with current params

Parameters:
Name Type Description
newParams Object

Object containing params

Returns:
Type
undefined

(static) triggerRouterReady() → {undefined}

Re-triggers router ready dependency

.

Source:

Re-triggers router ready dependency

Returns:
Type
undefined

(static) watchPathChange() → {undefined}

Watch path change.

Source:

Watch path change. Is Reactive.

Returns:
Type
undefined