Skip to content

Instantly share code, notes, and snippets.

@chris-brown
Created December 23, 2014 23:29
Show Gist options
  • Save chris-brown/8d815606f93a483a671d to your computer and use it in GitHub Desktop.
Save chris-brown/8d815606f93a483a671d to your computer and use it in GitHub Desktop.
renders handlebar template from github api data
(function ($j) {
"use strict";
var app = {
query: 'https://api.github.com/users/chris-brown/repos',
containerId: '#container',
init: function(){
this.getData();
},
getData: function(){
$j.getJSON(this.query, $j.proxy(this.callback, this))
},
callback: function(data){
if(data && data.length > 0){
var compiledTemplate = Handlebars.templates['demo-list'];
$j(this.containerId).html(compiledTemplate(data));
}
}
}
app.init();
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment