我第一次嘗試了Ember.js,大致遵循了Ember.js指南,但我遇到了以下問題。event.context使用{{#each ...}(undefined)時未被{{action ...}}設置
相關代碼: https://gist.github.com/3257657(完整的Rails應用程序,請參見:https://github.com/basveeling/ember-test)
語境: 我運行最新的餘燼,軌道建設與1.0搶鮮ember.js。我爲post模型使用了ember-data。
除了由{{action showPost context="post" href=true}}
創建的hrefs具有未定義的ID(#/posts/undefined
)之外,幾乎所有應用程序都可以在此應用程序中使用。 此外,傳遞給showPost
操作的jQuery事件沒有上下文屬性(它有一個視圖屬性)。
我是以這種錯誤的方式去做的,還是我可能偶然發現了預發佈中的錯誤?
編輯:這可能與Url contains 'undefined' instead of id after navigating back from 'edit' to 'show'
只是嘗試這樣做:它更新在href(例如,現在呈現給'...'),這似乎不錯,但點擊時,它指向#/職位/未定義出於某種原因。有任何想法嗎? 編輯:woops,忘記重置'showPost:function(router,event){...'回到showPost:Ember.Route.transitionTo('posts.show'),.謝謝你的幫助! – Bas 2012-08-04 13:36:11
你甚至可以發送幾個上下文對象。您將在event.contexts數組中包含它們 – 2012-08-04 17:42:34