lundi 22 août 2016

Ember.js Observer

I want to use observer on a variable which is in service, that's my code:

const get = Ember.get;

uploader:Ember.inject.service('uploader'),

progressChanged: Ember.observer(this.get('uploader').get('progress'), function() {console.log('observer is called', this.get('uploader').get('progress'));
 }),

That's the error:

Error while processing route: index this.get is not a function

When I'm trying to show the progress in alert:

actions:
    {
        getProgress()
        {
            alert("progress:"+this.get('uploader').get('progress'));
        }
    }

Everything works, but not in an observer. What i should do?

Greetings, Rafał




Aucun commentaire:

Enregistrer un commentaire