remove slash from $location.url() in angular


I need to get the GET params from url and pass it in the links to view in angular

I got from location.url() =>/?x=1&b=2

but I need to get = >?x=1&b=2” without slash

I tried to do that like the following:

var str =  $location.url();
var x = str.replace(/\\/g, '');

but it kept the slash


var str = $location.url().substr(1);

Answered By – Alexey Avdeyev

Answer Checked By – Mary Flores (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.