【发布时间】:2012-09-24 18:13:08
【问题描述】:
控制器看起来像这样
class App.ContactsController extends Tower.Controller
index: (params) ->
@set('person', App.HighrisePerson.create())
@render "index"
视图看起来像这样
App.ContactsEditView = Ember.View.extend
templateName: 'contacts/edit'
resourceBinding: 'controller.person'
init: (args...) ->
@._super(args...)
console.log(@.get('resource'))
console.log('inited')
通过上面的块,我在控制台中看到资源设置为我的 Ember.Object 的实例
但使用以下视图代码
div class: "row-fluid", ->
text "{{#with resource}}"
text "Hello"
text "{{/with}}"
父视图的相关部分
div class: "row-fluid contact-form", ->
div class: "row-fluid", ->
h1 "Want to work with us?"
p "So...you want to be kohactivated!?!? Please take a few moments to fill out the form below and provide us with some details about your project, company or start-up."
text "{{view App.ContactsEditView}}"
我没有看到 hello 的渲染输出
如果我将 hello 移到 #with 块之外,我会看到 hello,
所以我认为它由于某种原因无法识别资源
感谢任何帮助。
【问题讨论】: