Issue
I want to allow predefined query parameters before components load. For example I defined allowed parameters in array
let params = ['status', 'category'];
Redirect url is
let url='http://example.com/products?status=1&category=2'
I want to forbid another query parameter before redirect. What is the best method for example guard, resolver or etc.
Solution
Documentation for guards can be found here
As a general idea:
- Implement the guard.
- Extract the routes parameters
- Do your own manual checking
- Depending on your result return true for a valid request and false for an invalid request
If false is being returned the routing is aborted immediately and a user will not be able to navigate to the selected route.
Answered By - Exitare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.