Class sap.ui.core.routing.RouteModule: sap/ui/core/routing/Route
Constructor Summary
Event Summary
patternMatched(oEvent)
The 'patternMatched' event is fired, only when the current URL hash matches the pattern of the route.
Method Summary
sap.ui.core.routing.Route.extend(sClassName, oClassInfo?, FNMetaImpl?)
Creates a new subclass of class sap.ui.core.routing.Route with name
sClassName
and enriches it with the information contained in oClassInfo
.
sap.ui.core.routing.Route.getMetadata()
Returns a metadata object for class sap.ui.core.routing.Route.
attachMatched(oData?, fnFunction, oListener?)
Attach event-handler
fnFunction
to the 'matched' event of this sap.ui.core.routing.Route
.
attachPatternMatched(oData?, fnFunction, oListener?)
Attach event-handler
fnFunction
to the 'patternMatched' event of this sap.ui.core.routing.Route
.
detachMatched(fnFunction, oListener)
Detach event-handler
fnFunction
from the 'matched' event of this sap.ui.core.routing.Route
.
detachPatternMatched(fnFunction, oListener)
Detach event-handler
fnFunction
from the 'patternMatched' event of this sap.ui.core.routing.Route
.
getURL(oParameters)
Returns the URL for the route and replaces the placeholders with the values in oParameters
Methods borrowed from class sap.ui.base.EventProvider
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.core.routing.Route(The, oConfig, oParent?)
Instantiates a SAPUI5 Route
Parameters:
{sap.ui.core.routing.Router} | The | router instance, the route will be added to. |
{object} | oConfig | configuration object for the route |
{string} | oConfig.name | the name of the route - it will be used to retrieve the route from the router, it needs to be unique per router instance. |
{string} | oConfig.pattern? |
the url pattern where it needs to match again. A pattern may consist of the following:
|
{boolean} | oConfig.greedy? | @since 1.27: default: false - By default only the first route matching the hash, will fire events. If greedy is turned on for a route its events will be fired even if another route has already matched. |
{String} | oConfig.parent? | @since 1.32 This property contains the information about the route which nests this route in the form: "[componentName:]routeName". The nesting routes pattern will be prefixed to this routes pattern and hence the nesting route also matches if this one matches. |
{string|string[]} | oConfig.target? | one or multiple name of targets sap.ui.core.routing.Targets. As soon as the route matches, the target will be displayed. All the deprecated parameters are ignored, if a target is used. |
{string} | oConfig.view? | @deprecated since 1.28 - use target.viewName. The name of a view that will be created, the first time this route will be matched. To place the view into a Control use the targetAggregation and targetControl. Views will only be created once per Router. |
{string} | oConfig.viewType? | @deprecated since 1.28 - use target.viewType. The type of the view that is going to be created. eg: "XML", "JS" |
{string} | oConfig.viewPath? | @deprecated since 1.28 - use target.viewPath. A prefix that will be prepended in front of the view eg: view is set to "myView" and viewPath is set to "myApp" - the created view will be "myApp.myView". |
{string} | oConfig.targetParent? | @deprecated since 1.28 - use config.rootView (only available in the config). the id of the parent of the targetControl - This should be the id view your targetControl is located in. By default, this will be the view created by a component, or if the Route is a subroute the view of the parent route is taken. You only need to specify this, if you are not using a router created by a component on your top level routes. |
{string} | oConfig.targetControl? | @deprecated since 1.28 - use target.controlId. Views will be put into a container Control, this might be a sap.ui.ux3.Shell control or a sap.m.NavContainer if working with mobile, or any other container. The id of this control has to be put in here. |
{string} | oConfig.targetAggregation? | @deprecated since 1.28 - use target.controlAggregation. The name of an aggregation of the targetControl, that contains views. Eg: a sap.m.NavContainer has an aggregation "pages", another Example is the sap.ui.ux3.Shell it has "content". |
{boolean} | oConfig.clearTarget? | @deprecated since 1.28 - use target.clearControlAggregation. Default is false. Defines a boolean that can be passed to specify if the aggregation should be cleared before adding the View to it. When using a sap.ui.ux3.Shell this should be true. For a sap.m.NavContainer it should be false. |
{object} | oConfig.subroutes? | @deprecated since 1.28 - use targets.parent. one or multiple routeconfigs taking all of these parameters again. If a subroute is hit, it will fire tge routeMatched event for all its parents. The routePatternMatched event will only be fired for the subroute not the parents. The routing will also display all the targets of the subroutes and its parents. |
{sap.ui.core.routing.Route} | oParent? | The parent route - if a parent route is given, the routeMatched event of this route will also trigger the route matched of the parent and it will also create the view of the parent(if provided). |
Event Detail
matched(oEvent)
The 'matched' event is fired, when the current URL hash matches:
a. the pattern of the route. b. the pattern of its sub-route. c. the pattern of its nested route. When this occurs, the 'nestedRoute' parameter is set with the instance of nested route.
Please refer to event sap.ui.core.routing.Route#event:patternMatched|patternMatched for getting notified only when its own pattern is matched with the URL hash not its sub-routes or nested route.
Parameters:
{sap.ui.base.Event} | oEvent | |
{sap.ui.base.EventProvider} | oEvent.getSource | |
{object} | oEvent.getParameters | |
{string} | oEvent.getParameters.name | The name of the route |
{object} | oEvent.getParameters.arguments | An key-value pair object which contains the arguments defined in the route resolved with the corresponding information from the current URL hash |
{object} | oEvent.getParameters.config | The configuration object of the route |
{sap.ui.core.routing.Route} | oEvent.getParameters.nestedRoute? | The nested route instance of this route. The event is fired on this route because the pattern in the nested route is matched with the current URL hash. This parameter can be used to decide whether the current route is matched because of its nested child route. For more information about nested child route please refer to the documentation of oConfig.parent in sap.ui.core.routing.Route |
patternMatched(oEvent)
The 'patternMatched' event is fired, only when the current URL hash matches the pattern of the route.
Parameters:
{sap.ui.base.Event} | oEvent | |
{sap.ui.base.EventProvider} | oEvent.getSource | |
{object} | oEvent.getParameters | |
{string} | oEvent.getParameters.name | The name of the route |
{object} | oEvent.getParameters.arguments | An key-value pair object which contains the arguments defined in the route resolved with the corresponding information from the current URL hash |
{object} | oEvent.getParameters.config | The configuration object of the route |
Method Detail
sap.ui.core.routing.Route.extend(sClassName, oClassInfo?, FNMetaImpl?)
: function
Creates a new subclass of class sap.ui.core.routing.Route with name
sClassName
and enriches it with the information contained in oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.ui.base.EventProvider.extend.
Parameters:
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? |
Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
|
Returns:
{function} | Created class / constructor function |
sap.ui.core.routing.Route.getMetadata()
: sap.ui.base.Metadata
Returns a metadata object for class sap.ui.core.routing.Route.
Returns:
{sap.ui.base.Metadata} | Metadata object describing this class |
attachMatched(oData?, fnFunction, oListener?)
: sap.ui.core.routing.Route
Attach event-handler
fnFunction
to the 'matched' event of this sap.ui.core.routing.Route
.Parameters:
{object} | oData? | The object, that should be passed along with the event-object when firing the event. |
{function} | fnFunction | The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'. |
{object} | oListener? | Object on which to call the given function. If empty, this Model is used. |
- Since:
- 1.25.1
Returns:
{sap.ui.core.routing.Route} |
this to allow method chaining
|
attachPatternMatched(oData?, fnFunction, oListener?)
: sap.ui.core.routing.Route
Attach event-handler
fnFunction
to the 'patternMatched' event of this sap.ui.core.routing.Route
.Parameters:
{object} | oData? | The object, that should be passed along with the event-object when firing the event. |
{function} | fnFunction | The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'. |
{object} | oListener? | Object on which to call the given function. If empty, this Model is used. |
- Since:
- 1.25.1
Returns:
{sap.ui.core.routing.Route} |
this to allow method chaining
|
destroy()
: sap.ui.core.routing.Route
Destroys a route
Returns:
{sap.ui.core.routing.Route} | this for chaining. |
detachMatched(fnFunction, oListener)
: sap.ui.core.routing.Route
Detach event-handler
fnFunction
from the 'matched' event of this sap.ui.core.routing.Route
.The passed function and listener object must match the ones previously used for event registration.
Parameters:
{function} | fnFunction | The function to call, when the event occurs. |
{object} | oListener | Object on which the given function had to be called. |
- Since:
- 1.25.1
Returns:
{sap.ui.core.routing.Route} |
this to allow method chaining
|
detachPatternMatched(fnFunction, oListener)
: sap.ui.core.routing.Route
Detach event-handler
fnFunction
from the 'patternMatched' event of this sap.ui.core.routing.Route
.The passed function and listener object must match the ones previously used for event registration.
Parameters:
{function} | fnFunction | The function to call, when the event occurs. |
{object} | oListener | Object on which the given function had to be called. |
- Since:
- 1.25.1
Returns:
{sap.ui.core.routing.Route} |
this to allow method chaining
|