Andrei Varanovich
Andrei Varanovich

Reputation: 502

Emberjs child view binding

I have the following container

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

Then this view is connected to it

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

The actual view

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

isValid: true
email: ''
password: ''

Template:

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

How can I bind the isValid field to the view? It is undefined. Is that somehow related to the "outlet" in the parent view?

This example Binding child views and collections within an outlet in emberjs shows how to bind an arbitrary object to the view.

Upvotes: 1

Views: 576

Answers (1)

Mike Aski
Mike Aski

Reputation: 9236

You should use the view scope in your template:

is valid: {{view.isValid}}

Upvotes: 2

Related Questions