Skip to content

Instantly share code, notes, and snippets.

@GavinJoyce
Created March 30, 2018 15:05
Show Gist options
  • Save GavinJoyce/84bdc0490caa8b53f2cf305d9dfb54b6 to your computer and use it in GitHub Desktop.
Save GavinJoyce/84bdc0490caa8b53f2cf305d9dfb54b6 to your computer and use it in GitHub Desktop.
pluralize helper
import Ember from 'ember';
export default Ember.Controller.extend({
numberOfPeople: 0,
actions: {
increment(delta=1) {
this.incrementProperty('numberOfPeople', delta);
}
}
});
<button onclick={{action 'increment' 1}}>+</button>
<button onclick={{action 'increment' -1}}>-</button>
Found {{pluralize numberOfPeople "person"}}
{
"version": "0.13.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.16.2",
"ember-template-compiler": "2.16.2",
"ember-testing": "2.16.2"
},
"addons": {
"ember-data": "2.16.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment