mercredi 22 juin 2016

Show the newly created record on .save()

Ember 2.5

I have a page that displays a list of all types of commutes (/commutetypes). To create a new commute type, I go to commutetypes/new.

Once I save the new commute type and transition back to /commutetypes. The new commute type does not display on the list. Can I refresh the model to display it?

// save action in route.
save: function() {
    var _this = this;

    var com = this.store.createRecord('commutetype', {
        name: document.getElementById('nameInput').value,
        description: document.getElementById('descriptionInput').value
    });
    com.save().then(function(){
        _this.transitionTo('commutetypes');
    });
}




Aucun commentaire:

Enregistrer un commentaire