Skip to content

Instantly share code, notes, and snippets.

@groovecoder
Created November 16, 2012 20:40
Show Gist options
  • Save groovecoder/4090712 to your computer and use it in GitHub Desktop.
Save groovecoder/4090712 to your computer and use it in GitHub Desktop.
Geo.CoordsView = Backbone.View.extend({
el: $('#coordsView'),
tagName: 'span',
className: 'geoCoords',
initialize: function(options){
this.model.on('change:currentLng', this.render);
_.bindAll(this, 'render');
},
render: function(){
if (this.model.has('currentLng')) {
console.log("CoordsView, render, currentLng: " + this.model.get('currentLng'));
console.log("CoordsView, render, currentLat: " + this.model.get('currentLat'));
this.$el.html('<span class="lng" data-name="longitude">'+this.model.get('currentLng')+','+'<span class="lat" data-name="latitude">'+this.model.get('currentLat'));
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment