E
E
elailasou2015-04-29 16:07:17
JavaScript
elailasou, 2015-04-29 16:07:17

How in Backbone to call a function in a view from another function of this view?

Actually, code example:

var AppView = Backbone.View.extend({
    el: 'body',
    events: {
        'click p': 'event1',
    },
    event1: function(event) {
        console.log('event-1');
        // Как отсюда вызвать event-2?
    },
    event2: function(event) {
        console.log('event-2');
    }    
});
var appView = new AppView();

Accordingly, the console should be:
event-1
event-2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2015-04-29
@junk1114

this.event2();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question