Thomas
Thomas

Reputation: 1420

URL serialization does not work after page refresh

I'm facing a problem with emberJS and the Router.

My route architecture is the one below :

When I initialy navigate to display/:id the URL is well written as below :

localhost/#/app/item/display/da083d21-afab-4620-8a85-6a4e6bfb95b9

Then I hit the refresh button of my browser and the URL is then written as

localhost/#/app/item/display/undefined

I have the following functions in my route to handle serialize/deserialize

deserialize:  function(router, context) {
    return App.Item.find(context.id);
},
serialize:  function(router, context){
    return { id: context.id };
}

When I log the context passed in serialize :

So I guess I'm missing something to serialize my URL after page refresh.

Any lead ?

Thanks

Upvotes: 0

Views: 576

Answers (1)

Thomas
Thomas

Reputation: 1420

This question was already address in Emberjs async routing

Solution is to use a Deferred object and implement the loading state.

Hope that helps

Upvotes: 1

Related Questions