![]() |
VOOZH | about |
Introduction:
We can use the property binding concept and we can pass query parameters to routerLink. Using Property binding we can bind queryParams property and can provide the required details in object.
Property Binding: It is a concept where we use square bracket notation to bind data to Document Object Model(DOM) properties of Hypertext markup language(HTML) element.
Output:
👁 ImageWe can implement the route re-direction in two ways:
1) The first method is by doing from .html file.
2) The second method is from the .ts file.
Syntax for .html file:
Approach:
app.component.html:
After clicking on the anchor tag, then we can see that the url will be changed in the following way and we will be directed to the configured component in the app.module.ts file.
👁 ImageOutput:
state.component.html:
Second method from .ts file:
app.component.ts:
app.component.html:
After following the above code and one if you click on the anchor tag then the url will be changed and you will be redirected to the respective configured component.
👁 ImageOutput:
👁 Image