Ember form values are undefined
I have a similar form, when I want to get submitted values in newCategory
controller, I get 'undefined' values. What's wrong?
<form role="form" {{ action 'add' target="newItem" on="submit"}}>
<h2>New category</h2>
<div class="form-group">
<label>Category title</label>
{{input value=title class="form-control" type="text"
placeholder="Title"}}
</div>
<div class="form-group">
<label>Category description</label>
{{textarea value=description class="form-control"
placeholder="Description"}}
</div>
<div class="form-group">
{{input type="submit" class="btn" }}
</div>
</form>
App.NewItemController = Ember.ObjectController.extend({
add: function(){
console.log(this.get('title')); // undefined
}
});
No comments:
Post a Comment