3
Summary of the problem: It is one of those friendly URL’s that will be sent and within the parentheses will come next to the airport of the city, I need the route to be activated when it comes with these parameters.
Ex: /voos-sao-paulo(gru)
based on this route URL voos-
(which is the work of the function matcher
that is in stackblitz) I need to make a request by passing sao-paulo
and gru
(which will be extracted from the url) which is the airport of Womens for the API. The parameters of the city and the acronym of the airport will be dynamic and will have others as date, other airports and etc.
The function matcher
stackblitz works because all coming Urls will necessarily start with voos-
.
The problem is that with what comes inside the ( ) does not match the route and Angular throws an error and I can not catch what comes in the URL, if you come a route without the ( )
with only gru
the route enters the function matcher
and works as expected.
Stackblitz simulating the problem
https://stackblitz.com/edit/angular-nadrke?file=src%2Fapp%2Fapp.component.html
https://stackblitz.com/edit/angular-a8bdrn?file=src/app/hello.component.ts I set up your stackblitz just type /anything at the end of the url that should work
– Eduardo Vargas
You want to extract the value of parentheses ?
– Victor Henrique
@Eduardovargas did not serve
– TusaMAL
@Victorhenrique edited the post and I believe I have put a better explanation
– TusaMAL
Try to do with httpInterceptors if or with this dynamic parameter and call a service with parameters like in my stackblitz
– Eduardo Vargas
Can not use Interceptor pq will not ta at the angle yet
– TusaMAL