Friday, 11 December 2015

Exercise-5 : Creating a view that will get associated with an existing DOM element


Introduction
Backbone views are used to reflect what your applications’ data models look like. They are also used to listen to events and react accordingly. 

Inside Main.js write following code and inspect Object view1

Extend a Backbone View and instantiate the extended object
var sampleView = Backbone.View.extend({
    initialize: function() {
        console.log('sampleView has been created');
    }
});
var view1 = new sampleView({ el: $("#search_container") });

No comments:

Post a Comment