0

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

2
  • 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. Commented Mar 6, 2015 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. Commented Mar 6, 2015 at 11:19

1 Answer 1

0

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."

Sign up to request clarification or add additional context in comments.

Comments

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.