Skip to content

Instantly share code, notes, and snippets.

@ryanlabouve
Last active January 5, 2017 06:23
Show Gist options
  • Select an option

  • Save ryanlabouve/c13d740be642b19c28da4906c4f4ae6c to your computer and use it in GitHub Desktop.

Select an option

Save ryanlabouve/c13d740be642b19c28da4906c4f4ae6c to your computer and use it in GitHub Desktop.
Kata 5
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super(...arguments);
this.auditLog = [];
},
actions: {
addToAuditLog(field, value) {
this.get('auditLog').push(`${field} name has changed to ${value}`);
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'File not used.'
});
<input
onchange={{pipe
(action 'addToAuditLog' 'fullName')
(mut fullName) value="target.value"}} />
<input
onchange={{queue
(action 'addToAuditLog' 'fullName')
(mut fullName) value="target.value"}} />
There have been {{auditLog.length}} changes:
{{#each auditLog as |audit|}}
<li>
{{audit}}
</li>
{{/each}}
{
"version": "0.10.7",
"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.10.0",
"ember-data": "2.10.0",
"ember-template-compiler": "2.10.0",
"ember-testing": "2.10.0"
},
"addons": {
"ember-composable-helpers": "1.1.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment