Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

Change model id and transitioning

$
0
0

@ofridagan wrote:

Hi,

(This may sound odd, and I'll be happy to hear a different approach for achieving what I need...)

I have a route, let say /post/:post_id.

In this route there is an operation to "clone" the current post. This operation sends request to the server, which duplicates the post and returns the newly created post-id.

Now I want to transition to this post.

I could just:

this.transitionTo('post', newPostId)

but this seems too expensive operation for just transitioning to a cloned post (as it will cause another trip to the server, and also cause all computed properties, etc to be recalculated).

I'm trying to optimize this by replacing the id of the original post:

thePost = this.modelFor('post');

thePost.set('id', <the new id from server>);

this.transitionTo('post', thePost)

but this doesn't seem to update the url...

any advice?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles