I created very simple Ember app, using Ember Data. There is one form where the user creates the entity and submits. It's in BandsNewView
(created automatically by Ember), controlled by BandsNewController
:
App.BandsNewController = Ember.Controller.extend({
cancel: function() {
this.transitionTo('bands');
},
save: function() {
App.Band.createRecord(this);
this.get('store').commit();
this.set('name');
this.set('description');
this.transitionTo('bands');
}
});
I wonder whether there is simplier solution to "clean up" (i.e empty) the form after saving new Band entity? Can I say something like this.set()
, which would empty all the fields? Or is my approach essentially wrong and should I do it completely differently?