Skip to content

Instantly share code, notes, and snippets.

@sylwiaeb
Last active February 18, 2016 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sylwiaeb/52fb74f39b4c16225267 to your computer and use it in GitHub Desktop.
Save sylwiaeb/52fb74f39b4c16225267 to your computer and use it in GitHub Desktop.
[handlebars] UI firendly index
// Returns 1,2,3,... indexes based on even index from {{#each}} loop
import Ember from 'ember';
export function ruleNo(val) {
return val === 0 ? 1 : val / 2 + 1;
}
export default Ember.Helper.helper(ruleNo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment