F
F
fantom00052015-12-04 14:44:34
JavaScript
fantom0005, 2015-12-04 14:44:34

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

2 answer(s)
N
Nicholas, 2015-12-04
@fantom0005

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

B
bromzh, 2015-12-04
@bromzh

Google banned?
https://github.com/angular-ui/ui-router
christopherthielen.github.io/ui-router-extras/#/home
But in vain.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question