LwrConfigRouteDefinition
To configure a router module with the Router Module Provider, you have to set up both LwrRouterConfig
and LwrConfigRouteDefinition
.
LwrConfigRouteDefinition
object contains similar properties as the RouteDefinition
object. handler
and component
are string references, as LwrConfigRouteDefinition is pure JSON and can't contain any functions. Only define either the handler
or component
property, not both.
Property | Type | Required/Optional | Description |
---|---|---|---|
id | String | Optional | Each LwrConfigRouteDefinition must have a unique id identifier. |
uri | String | Optional | A pattern for URI locations that match the LwrConfigRouteDefinition . You can't use the # and * characters. |
page | Required | The form of page references that match the LwrConfigRouteDefinition . page values can be :parameter bindings, which map a path or query parameter from the URI to an attributes or state property, or literal bindings, which hard code a type , attribute , or state property to a literal value. Literal bindings can't contain the following characters: ? , * , # , & , + , ; , ( , ) . | |
patterns | Optional | A regular expression that a parameter has to match to be valid. To prevent unexpected values in the expression pattern, explicitly wrap the expression in the start-of-line character (^ ) and end-of-line character ($ ). For example: {"patterns": {"parameter": "^id[0-9a-zA-Z]{5}$"}} . | |
exact | Boolean | Optional | If there's a nested router, this value must be false . The default value is true . |
metadata | Optional | Developer-defined metadata in the form of key (string) and value (any type) pairs. You can use the metadata property to attach additional information to an LwrConfigRouteDefinition . Extend LwrConfigRouteDefinition for required or more strongly typed metadata. | |
handler | String | See description | An LwrConfigRouteDefinition must contain a handler or a component, but not both. handler is a string reference to the RouteHandler class specifier. |
component | String | See description | An LwrConfigRouteDefinition must contain a handler or a component, but not both. component is a string reference to the view component specifier. Use this property to directly specify the view component without authoring a route handler. |
See Also