jeudi 29 décembre 2016

Using .bind() in function does not work [duplicate]

This question already has an answer here:

I have the follow statement in one controller which is inheriting another one:

this.actions.changePageSize(page_size).bind(this);

And in the parent controller I have this

actions: {
    changePageSize(page) {
        this.set('page_size', page);
    },

I get the error

TypeError: this.set is not a function

If I pass this as an argument and use its alias, it works. Like this:

 this.actions.changePageSize(this, page_size);

 actions: {
    changePageSize(_this, page) {
        _this.set('page_size', page);
    },




Aucun commentaire:

Enregistrer un commentaire