dimanche 1 mars 2015

How do I create controller for creating entity in ember

I know I can add variables into controller and then access them in input and in controller. But if i want to work with entity, i would need to write down all of its properties.



// controller
name: '',
website: 'http://www.',

actions: {
doneEditing: function() {
var name = this.get('name');
var website = this.get('website');

var company = this.store.createRecord('company', {
name: name,
website: website
});
company.save();
}
}

// template
<p>{{input type="text" value=name}}</p>
<p>{{input type="text" value=website}}</p>


How can be this done properly?





Aucun commentaire:

Enregistrer un commentaire