mardi 9 août 2016

Maintaining component state through route transitions - EmberJS

I am building a single page music web app using Ember. Each track is represented on the page as a component. There are many tracks on a given page. When a user clicks play, the component updates its UI to reflect that and the master route keeps track of which track is currently playing.

But when I switch routes to explore other parts of the app, and then return to the one where the track is playing, Ember has destroyed and rebuilt each component, setting everything back to its initial state and making the route's current_track object obsolete.

How would I best maintain state like this across route transitions?

My route hierarchy:

master-route 
    liked-tracks
    favorite-tracks
    posted-tracks




Aucun commentaire:

Enregistrer un commentaire