The route has:
queryParams: {
page: {
refreshModel: true
}
},
model: function(params) {
return this.store.findRecord('article', params.article_id);
},
setupController(controller, model) {
let params = this.paramsFor(this.routeName);
this.store.query('comment', { filter: { 'article-id': model.id }, page: { number: (params.page ? params.page : 1) } }).then(comments => {
controller.set('comments', comments);
})
}
Controller has:
queryParams: ['page'],
page: null,
And template:
{{#link-to “articles.show” model.id (query-params page=pageMeta.next) class="button -blue -mini"}}Next{{/link-to}}
Clicking on Next takes me to http://localhost:4099/articles/7?page=2, but the comments in the template are not refreshed. But when I manually refresh the page. The new comments are shown.
It seems like the query params in setupController isnt being updated. What could be going wrong here?
Aucun commentaire:
Enregistrer un commentaire