jeudi 20 août 2015

Triggering model hook when transitioning to same route with same queryParams

How do I trigger my model hook when re-transitioning to the same route when you have queryParams that doesn't change (and they are set to refreshModel : true)?

For example, right now I'm in route 'conversations' with queryParam itemCount = 0 which request 10 conversations from my back-end. When I unload a conversation from the store, I now have 9 conversations.

I want to refetch 10 conversations from my back-end (so I always have at least 10 conversations) but with the same queryParam itemCount = 0. How can I do it?

I tried this in my controller where I want to refresh the model:

this.transitionTo('conversations', { queryParams : { itemCount = 0 }});

but it won't trigger my model hook and I think it is for the following reaons :

1 - I am already on this route 2 - The queryParam isn't changing

How do you force a model to reload? I read about the reload method in my route but I am lost in all this.

Thank you.




Aucun commentaire:

Enregistrer un commentaire