Ember.js与Rails4:浏览器返回按钮崩溃ember应用程序 [英] Ember.js with Rails4: browser back button crash ember application

查看:126
本文介绍了Ember.js与Rails4:浏览器返回按钮崩溃ember应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:问题解决了。您只需移除 turbolinks 即可。



使用 Rails4 应用程序,使用 ember-rails 0.13.0 我们有一个无法使用功能浏览器的问题按钮。每次在使用后退按钮返回上一个路线时,应用程序都会崩溃,这些错误:Firefox / $ b

  TypeError:Class.PrototypeMixin.applyPartial不是一个函数@ http:// localhost:3000 / assets / ember.js?body = 1:11933 

在Chromium 28:

 未捕获错误:jquery-ujs已经加载! 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 非常好。



来自其他人与 ember.js 有问题的报告使用 turbolinks

 无法对不在DOM 
中的Metamorph执行操作


解决方案

经过一些调试,我们注意到那些是 turbolinks 导致问题。使用反向按钮触发 turbolinks ,这与ember.js应用程序引起了奇怪的影响,如重新加载所有javascripts,从而覆盖应用程序的状态。



删除 turbolinks 完成了这项工作。以下是一个有用的链接: http:// blog。 steveklabnik.com/posts/2013-06-25-removing-turbolinks-from-rails-4


EDIT: the issue is solved. Removing turbolinks is all you need to do.

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:

on Firefox 24.0a2:

TypeError: Class.PrototypeMixin.applyPartial is not a function @ http://localhost:3000/assets/ember.js?body=1:11933

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: ------------------------------- 

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.

Reports from other people having problems with ember.js together with turbolinks:

Cannot perform operations on a Metamorph that is not in the DOM

解决方案

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.

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与Rails4:浏览器返回按钮崩溃ember应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆