2

So basically I am trying to get angularJs Routes to look like this

 www.example.com/ajax.html#!product=1234

instead of like this

www.example.com/ajax.html#/product/1234

is there any hope?

2 Answers 2

6

You just have to configure the $location service and call:

$locationProvider.hashPrefix("!")
Sign up to request clarification or add additional context in comments.

3 Comments

heres a small discussion on it with some caveats on doing this though groups.google.com/forum/?fromgroups=#!topic/angular/pMEvWSR8ffA
google said you don't need that anymore, you just have to turn on html push state in locationprovider and add <meta name="fragment" content="!"/> to head
@calmbird it does not prevent to use #! instead of the pushState API if you prefer to. BTW, configuring properly the HTTP server to serve capture with #! URLs is far easier.
1

If your running a ruby app and want to adhere to the google ajax crawling scheme - there's a gem that implements the crawling scheme for any rack app....

gem install google_ajax_crawler

writeup of how to use it is at http://thecodeabode.blogspot.com.au/2013/03/backbonejs-and-seo-google-ajax-crawling.html, source code at https://github.com/benkitzelman/google-ajax-crawler

1 Comment

unfortunately yes as its a ruby gem which runs as rack middleware, so only those ajax heavy apps running a ruby rack backend (i.e. rails / sinatra)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.