Skip to content

Instantly share code, notes, and snippets.

@zoghal
Created September 21, 2013 15:46
Show Gist options
  • Save zoghal/6651728 to your computer and use it in GitHub Desktop.
Save zoghal/6651728 to your computer and use it in GitHub Desktop.
My Ember Handlebars Helper Collection
/*
{{loop countroller.count}}
{{name}}
{{/loop}}
*/
Ember.Handlebars.registerHelper('loop', function(property, options) {
var out = "";
var count = Ember.get(this, property);
if(Ember.typeOf(count) === 'number' && count >= 1 ){
while (count--) {
out+= options.fn(this);
}
}
return new Handlebars.SafeString(out);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment