1

How to fetch the data from URL and use it. I Have 2 pages where I am redirecting the data from one page to other.

Here is the code for first page:

 <a href="product.html?catid={{child.name}}"> {{child.name}} </a>

on product.html how do I fetch the URL and the catid data.

If I use $location.path(); it is giving me an error

$location not defined

How do I fetch the information from URL?

P P P
  • 227
  • 3
  • 16
Rocking Birds
  • 165
  • 1
  • 15

1 Answers1

0

If on product.html you are not using angular or any routing mechanism you could always get the current url using the following:

var url = window.location.href;

From here on, you will have to parse the corresponding query string parameters (in your case catid) in order to obtain the desired value. The following thread could give you some example on how to achieve that.

Community
  • 1
  • 1
Darin Dimitrov
  • 960,118
  • 257
  • 3,196
  • 2,876