0
我想要追加HTML元素在用戶點擊UI內編譯,這種元件將這樣進行組裝和預編譯的視圖組件內:按需車把Ember.view部件
NewElementView = Ember.View.extend(
tagName: 'li',
click: ((event)->
this.insertElement()
),
blueprint: (->
'<div id="{{dom_id}}">
<textarea></textarea>
<button {{action "submit"}}>Save</button>
</div>'
).property()
insertElement: (->
html = this.get("blueprint")
template = Ember.Handlebars.compile(html)
context = { dom_id: "foo" }
Ember.$(template(context)).appendTo("#container")
)
)
在運行時Ember.Handlebars.compile(html)
它提出的行Uncaught TypeError: Cannot read property 'push' of undefined
任何想法爲什麼?
在此先感謝!