lundi 12 septembre 2016

Ember action or this.get work only once

I have this index controller.

import Ember from 'ember';

export default Ember.Controller.extend({
    actions: {
        reload() {
            console.log('click on button reload');
            this.get('doReload');
        }
    },
    doReload: Ember.computed(function() {
        console.log('do reload method');
        // ajax action will be here.
    }),
});

And this is button in the template.

<button type="button" class="btn btn-secondary btn-sm" >Reload</button>

When I click on the button for the first time, console.log() contain 2 line of messages correctly.

click on button reload
do reload method

But when I click on the button for second time or more, console.log() contain contain only one line. It doesn't call doReload again.

click on button reload

How to make this.get work every time I click on the action button?




Aucun commentaire:

Enregistrer un commentaire