lundi 31 octobre 2016

Ember refreshing model from current route

I have a route /search that has a component (search bar) which calls an action on the route to refresh the model. The component is used on the index route as well as the search route, something like this:

home> search bar search> search bar

The search bar component calls an action that calls the following on index:

actions: {
    goSearch: function(val) {
        this.transitionTo('search', {queryParams: {keyword: val}});
    }
}

On the search route, I have to add:

this.refresh();

in order to get the model to reload. Without it, it only changes the URL.

This works great but hitting back on the browser does not reload the model.

How should I go about this? I'm pretty sure I'm going about something wrong here.




Aucun commentaire:

Enregistrer un commentaire