Ember 1.13 Route doesn't refresh model on paging


#1

I’m using Ember w/ data v1.13

I have a Route:

// app/routes/items.js
import Ember from 'ember';

export default Ember.Route.extend({
    queryParams: {
        page: {
            refreshModel: true
        }
    },

    model(params) {
        return this.store.query('item', params);
    },

    actions: {
        pagination(page) {
            this.transitionTo({
                queryParams: {
                    page: page
                }
            });
        }
    }
});

This doesn’t work - AJAX is not sent, data isn’t updated, nothing happens. It’s fixed if I add:

// app/controllers/items.js
import Ember from "ember";

export default Ember.ArrayController.extend({
    queryParams: ["page"]
});

But then it gives me deprecation warning - “DEPRECATION: Ember.ArrayController is deprecated.”

I’m new to Ember and probably I’m doing something wrong. Could you help me?


#2

You can just change that to Ember.Controller.extend …

I’m a bit new to Ember as well, so not sure why you need the controller, though. I’ve had g.ood results using the ember-cli-pagination package


#3

Hmm it does work. But I am not sure about one thing that it was working fine in 1.12 without controller for me, and now when I updated it to 1.13 it stopped working and now I have to make controller for that.

As far as I know controllers will be deprecated in version 2 or 2.2 so why forced us to add controllers again