Ember.js with Rails4:浏览器后退按钮崩溃 ember 应用程序 [英] Ember.js with Rails4: browser back button crash ember application
问题描述
问题已解决.您只需删除 turbolinks.
the issue is solved. Removing turbolinks is all you need to do.
对于 Rails4 应用程序,使用 ember-rails 0.13.0 我们遇到了浏览器后退按钮不起作用的问题.每次使用后退按钮返回上一条路线时,应用程序都会因此类错误而崩溃:
With a Rails4 application the use ember-rails 0.13.0 we have a problem of not functional browser back button. Each time while getting back to previous route using the back button the application is crashing with such errors:
在 Firefox 24.0a2 上:
on Firefox 24.0a2:
TypeError: Class.PrototypeMixin.applyPartial is not a function @ http://localhost:3000/assets/ember.js?body=1:11933
在 Chromium 28 上:
on Chromium 28:
Uncaught Error: jquery-ujs has already been loaded! jquery.js?body=1:517I
DEBUG: ------------------------------- ember.js?body=1:364
DEBUG: Ember.VERSION : 1.0.0-rc.6.1 ember.js?body=1:364
DEBUG: Handlebars.VERSION : 1.0.0 ember.js?body=1:364
DEBUG: jQuery.VERSION : 1.10.2 ember.js?body=1:364
DEBUG: -------------------------------
看起来整个应用程序堆栈都再次加载,以非功能性代码库结束.无论如何,相同的应用程序可以与 Rails3 完美配合.
It looks like the whole application stack is loaded again that ends with not functional code base. Anyway the same application works perfectly good with Rails3.
其他人在使用 ember.js 和 turbolinks 时遇到问题的报告:
Reports from other people having problems with ember.js together with turbolinks:
Cannot perform operations on a Metamorph that is not in the DOM
推荐答案
经过一些调试,我们注意到那些是 turbolinks 导致了问题.使用后退按钮触发 turbolinks,这会对 ember.js 应用程序造成奇怪的影响,例如重新加载所有 javascript,从而覆盖应用程序的状态.
After some debugging we had noticed those are turbolinks causing the problem. Using backbutton triggered turbolinks which were causing strange effects with the ember.js application like reloading all javascripts and thus overriding the state of app.
删除turbolinks 完成了工作.这是一个有用的链接如何做到这一点:http://blog.steveklabnik.com/posts/2013-06-25-removing-turbolinks-from-rails-4
Removing turbolinks done the job. Here is a useful link how to do it: http://blog.steveklabnik.com/posts/2013-06-25-removing-turbolinks-from-rails-4
这篇关于Ember.js with Rails4:浏览器后退按钮崩溃 ember 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!