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.

PropertyTypeRequired/OptionalDescription
idStringOptionalEach LwrConfigRouteDefinition must have a unique id identifier.
uriStringOptionalA pattern for URI locations that match the LwrConfigRouteDefinition. You can't use the # and * characters.
pageRequiredThe 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: ?, *, #, &, +, ;, (, ).
patternsOptionalA 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}$"}}.
exactBooleanOptionalIf there's a nested router, this value must be false. The default value is true.
metadataOptionalDeveloper-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.
handlerStringSee descriptionAn LwrConfigRouteDefinition must contain a handler or a component, but not both. handler is a string reference to the RouteHandler class specifier.
componentStringSee descriptionAn 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