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

heartmon
  • 1,411
  • 2
  • 13
  • 14
  • 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 06 '15 at 09: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 06 '15 at 11:19

1 Answers1

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

Community
  • 1
  • 1
heartmon
  • 1,411
  • 2
  • 13
  • 14