vendredi 13 avril 2018

Ember alternative to query params with service

So I have a route with this model:

model() {
   var self = this;
   return RSVP.hash({
    comptes : this.get('store').findAll('compte'),
    contrats: 
    this.get('store').findAll('contrat').then(function(contrats) {
      return contrats.filterBy("contrat_fk.id", 
         self.get('currentContract.contrat.id'));
      }),
    })
  }

My goal is to filter the model contrat with the value provided by my service currentContract.

It works fine when the page is reloaded, but when I change the route and comeback to this route, the model doesn't seem to be loaded and I have to reload the page to see it.

And I don't really wan't to use query params and put the contract id in the URL




Aucun commentaire:

Enregistrer un commentaire