1

I've got an AngularJS project, and I'm using $routeProvider and $locationProvider with ngView to swap out parts of the DOM as necessary. I'm running Angular 1.0.6.

However, when I define a link in my document like <a href="#!/view2">View 2</a>, it gets turned into ?q=home/#!/view2 when I click on it.

Why does the query string get added? How can I prevent that?

4
  • I'm unfamiliar with the "#!" notation. I've used angular routing and the format is always /#/pageName. What version are you using? What is your server env? Commented Aug 1, 2013 at 17:50
  • It's the standard Google uses to index Ajax websites. I'm setting it using $locationProvider.hashPrefix("!");. See developers.google.com/webmasters/ajax-crawling/docs/… for details. Commented Aug 1, 2013 at 18:00
  • Could you provide a plnkr? I have not experienced what you describe so I'm wondering what you mean with "using $routeProvider and $locationProvider". Commented Aug 1, 2013 at 20:21
  • possible duplicate of Why is AngularJS duplicating the query string in my route? Commented Dec 23, 2014 at 19:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.