当{{#each ...}(未定义))使用{{action ...}}设置的event.context [英] event.context not set by {{action ...}} when using {{#each ...} (undefined)
问题描述
我第一次尝试Ember.js,大致遵循Ember.js指南,但我遇到以下问题。
I'm trying out Ember.js for the first time by roughly following the Ember.js guide, but I'm running into the following problem.
相关代码:
https://gist.github.com/3257657 (对于完整的rails应用程序,请参阅: https://github.com/basveeling/ember-test )
Relevant code: https://gist.github.com/3257657 (for complete rails app, see: https://github.com/basveeling/ember-test)
上下文:
我正在运行最新的ember-rails构建与1.0预发布ember.js。我正在使用ember-data作为帖子模型。
Context: I'm running the latest ember-rails build with the 1.0 prerelease ember.js. I'm using ember-data for the post model.
几乎所有的功能都在这个应用程序中,除了由 {{action showPost context =posthref = true}}
有一个未定义的id(#/ posts / undefined
)。
此外,传递给 showPost
操作的jQuery事件没有context属性(它有一个view属性)。
Almost everything works in this app, except that the hrefs created by {{action showPost context="post" href=true}}
have an undefined id (#/posts/undefined
).
Furthermore, the jQuery event passed to the showPost
action doesn't have a context property (it does have a view property).
我是以错误的方式进行的,或者我可能偶然发现预发行的错误?
Am I going at this the wrong way, or have I perhaps stumbled on a bug in the prerelease?
编辑:这可能是相关的网址包含未定义而不是从编辑返回到显示后的id。
edit: this might be related to Url contains 'undefined' instead of id after navigating back from 'edit' to 'show'
推荐答案
尝试更改 {{action showPost context =posthref = true}}
to {{action showPost post href = true}}
1.0预发行更改了操作帮助器。
The 1.0 prerelease has changed the action helper.
更多信息: https://github.com/emberjs/ember.js/commit/83b7a61a892e55423cf1e66f606b13435bcab8f0
这篇关于当{{#each ...}(未定义))使用{{action ...}}设置的event.context的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!