korywka
korywka

Reputation: 7653

How to call model method from events?

I have method in model:

decrease: function(){
    this.save({
        count: this.get('count') - 1
    });
}

Next, i call method in view for event:

'click [data-skills="minus"]': 'decrease'

And from this method, i call method from model: (#3)

decrease: function(){
    this.model.decrease();
}

Is there some way to call model's method directly from events? Without step #3.

Upvotes: 1

Views: 67

Answers (1)

CD..
CD..

Reputation: 74096

events: {
    'click [data-skills="minus"]': function(){
       this.model.decrease();
     }
}

Upvotes: 2

Related Questions