Tuesday, April 24, 2012

Get and set value of TextField

I have this code for view:



App.TodoView = Em.View.extend({
labelView: Em.TextField.extend({

}),
createNew:function () {
console.log(this.labelView.get('value'));
}
});


and this template:



{{#view App.TodoView}}    
{{view labelView}}
{{#view Em.Button target="parentView" action="createNew"}}Add{{/view}}
{{/view}}


And I get the following error:



Uncaught TypeError: Object (subclass of Ember.TextField) has no method 'get'


I want to use insertNewLine method too, so I can set the value of the Em.TextField in template.





No comments:

Post a Comment