I am calling a view passing url parameters to perform specific custom actions. Once, these actions have been processed, I would like to use the router to move to another page but removing the url parameters first.
To be more specific:
Link containing url parameters leads to main page as its route has an empty pattern.
example.com/?urlParam1=Test&urlParam2=Boum
Once the controller has processed the request, I am using the router to nav to another view by calling
getRouter().navTo("ViewX", {}, false)
The url in the browser changes to
example.com/?urlParam1=Test&urlParam2=Boum/#/ViewX
The url parameters are still visible. Any chance to remove them?
Cheers
From what I understand from your question you have lets say 2 routes and something like this
routes : [ {
pattern : "Val1",
name : "Main",
view : "Main",
viewId : "Start"
},{
pattern : "Val2",
name : "Next",
view : "Next",
viewId : "Start1"
} ]
Now you invoke the route "Main" and your URL will be something like
http://applicationurl:port/ProjectName#Val1
and from here you invoke route Next then system will automatically change the url to
http://applicationurl:port/ProjectName#Val2
This is supported out of the box by SAPUI5 routing . Is there something different you want to achieve?
EDIT : Updated Answer
Nope not from the current view.
But i can suggest a workaround. Have one more route to the same view without the parameters of your concern. Now you can call the route after the action is performed leading to same view being loaded.
Couple of points to remember
As a side note the routes are meant for Bookmarking and addressable feature. I would suggest you think about handling the action via the EventBus in SAPUI5.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments