Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I am developing a web app using AngularJS and Angular-UI-router but get template for each page from server-side routing using Rails.

The problem is when I go to, for example

localhost/#/webboard (templateUrl: '/webboard')

and go to next page

localhost/#/topic/3 (templateUrl: '/posts/:post_id')

When I click the back button on the browser, usually the ui-view element turns blank. No error. the url and state change are working normally. After the blank ui-view occurs, backing to the other states does not appear anything, as well. Need to refresh the page to work and if I click back, the same thing happen again.

Has Anyone ever face this problem ? What should I do or did I miss something ?

Thank you

share|improve this question
    
I'm not sure why you serve the template for each page using Rails. Instead, you could just define the route with rails, and then do all of the routing with angular. – Tony Barnes Mar 6 '15 at 9:48
    
I use both because I would like to make the server initialize some data along with html template before serve to the client (AngularJS app). Also, I use routing with AngularJS to set which page will use which server-side route. – heartmon Mar 6 '15 at 11:19

Now I can solved my problem. The problem is due to Rails's turbolinks. Just remove it.

AngularJS + Rails: Back Button "WARNING: Tried to load angular more than once."

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.