我是第一次大致按照 Ember.js 指南尝试 Ember.js,但我遇到了以下问题。
相关代码: https://gist.github.com/3257657 (有关完整的 Rails 应用程序,请参阅:https://github.com/basveeling/ember-test)
上下文: 我正在使用 1.0 预发布版 ember.js 运行最新的 ember-rails 构建。我将 ember-data 用于后期模型。
除了由 {{action showPost context="post"href=true}}
创建的 hrefs 有一个未定义的 id (#/posts/undefined
)。
此外,传递给 showPost
操作的 jQuery 事件没有上下文属性(它有 View 属性)。
我是不是走错了路,或者我是否偶然发现了预发行版中的错误?
编辑:这可能与 Url contains 'undefined' instead of id after navigating back from 'edit' to 'show' 有关
最佳答案
尝试更改 {{action showPost context="post" href=true}}
至 {{action showPost post href=true}}
1.0 预发布版更改了 action helper。
更多信息:https://github.com/emberjs/ember.js/commit/83b7a61a892e55423cf1e66f606b13435bcab8f0
关于ember.js - 使用 {{#each ...} 时,{{action ...}} 未设置 event.context(未定义),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11808995/