【问题标题】:Emberjs child view bindingEmberjs 子视图绑定
【发布时间】:2012-08-03 18:51:08
【问题描述】:

我有以下容器

script type: 'text/x-handlebars', 'data-template-name': 'application', ->
text '''
{{outlet}}      
'''  

那么这个视图就和它相连了

script type: 'text/x-handlebars', 'data-template-name': 'index', ->
text '''
{{view App.SignUpView}}
'''

实际视图

App.SignUpView = Ember.View.extend
templateName: 'signup'

isValid: true
email: ''
password: ''

模板:

script type: 'text/x-handlebars', 'data-template-name': 'signup', ->
text '''
  is valid: {{isValid}}
'''

如何将 isValid 字段绑定到视图?它是未定义的。这是否与父视图中的“出口”有关?

此示例Binding child views and collections within an outlet in emberjs 展示了如何将任意对象绑定到视图。

【问题讨论】:

标签: ember.js


【解决方案1】:

您应该在模板中使用视图范围:

is valid: {{view.isValid}}

【讨论】:

  • 很高兴我能帮上忙 :-) 这对你来说是正确的答案吗?如果是,你可以接受。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-01-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-04
相关资源
最近更新 更多