I have an index page which has an action that creates a record. Then I want to transition to that record, the route has a dynamic segment. I got it working but in a horrible way assigning that = this. I think there is a better way to do this.
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
submitHandle: function() {
var newCard = this.store.createRecord('card', {
handle: this.get('handle')
}),
that = this;
newCard.save().then(function(savedCard) {
that.transitionToRoute('card.build', savedCard.get('id'));
})
}
}
});
Aucun commentaire:
Enregistrer un commentaire