3
林在運行時的方法試圖在運行時生成的餘燼和代碼一些方法我想是產生emberJS
App.TestController = Ember.ArrayController.extend App.AnotherMixin,
unsubmitted: Em.computed.filterBy("model", "unsubmitted", true)
submitted: Em.computed.filterBy("model", "submitted", true)
canceled: Em.computed.filterBy("model", "canceled", true)
# Rather than using above methods I'm trying to generate them with meta-programming.
that: @
defineAttributes: (->
[
"unsubmitted"
"submitted"
"cancelled"
].forEach (f) ->
Em.defineProperty that , f, Em.computed.filterBy("model", f, true)
return
return
).on("init")
但它不是產生方法。那麼我有什麼遺漏?