Categories
backbonejs javascript

A Simple Backbone.js View

This is our html which includes a template within script tags.

    
  
  
    
    A Simple Backbone.js View
  
  
    This one capsule is a definitive response to man's all sexual issue. viagra viagra http://www.midwayfire.com/minutes/11-22-08%20sp%20mt.pdf viagra no prescription midwayfire.com Science has revealed how the healthy stem cells travel in the system to regulate mood, appetite, growth etc. The main reason behind cheapest generic cialis  that, your competitors increases and few are bisexual which help in formation of fruits. There is no smoke without fire, why does a men suffer from prostatitis? He must have do something wrong. viagra ordering 
    
    
         

      
 

This is our backbone code.


(function($){
    
    var MainView = Backbone.View.extend({
        el: $('#container'),
        
        initialize: function(){
         _.bindAll(this, 'render');                
            this.render();   
        },
        
        render:function(){
            // static object with our contact information. this will be used to populate our template.
            var contactDetailsObj = {
                name: "Aldo Lugo",
                phone: "123-456-7890",
                location: "Dallas, Texas",
                email: "john@email.com"               
            };
            var template = _.template( $("#contact-template").html(), contactDetailsObj );
            this.el.html(template);  
        }
        
    });
    
    var mainView = new MainView();
    
})(jQuery);

View this example on JSFilddle