Answer the question
In order to leave comments, you need to log in
AngularJS How to change get parameters in url and read them?
Hello.
I am developing a SPA online store. All products are on the main page, and product information is displayed in a modal window and loaded through the REST Api. Accordingly, I do not use routing.
But I was given a task: when you click on a link that contains the product id, a modal window with information about the product should open. I guess one should use the get parameter url( ?id=10).
How can I take the get parameter and modify the url?
Answer the question
In order to leave comments, you need to log in
Use the $location service.
Query parameters can be obtained like this:
and set - through the same method, passing an object of the type key-value:
Angular doc about the $location service here: https://docs.angularjs.org/api/ng/service/$location
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question