Answer the question
In order to leave comments, you need to log in
Ember how to update model after creation?
I create a post
var newPost = this.store.createRecord("post", {
title: this.get("title"),
text: this.get("text"),
intro: this.get("intro")
});
newPost.save();
this.transitionToRoute("admin.posts");
App.AdminPostsRoute = Ember.Route.extend({
model: function () {
return this.store.find("post");
}
});
Answer the question
In order to leave comments, you need to log in
Apparently, the fact is that you go to another page even when the request has not been completed, try this:
var newPost = this.store.createRecord("post", {
title: this.get("title"),
text: this.get("text"),
intro: this.get("intro")
});
var _this = this;
newPost.save().then(function() {
_this.transitionToRoute("admin.posts");
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question