Skip to content

Instantly share code, notes, and snippets.

@feanor07
Last active March 30, 2017 12:28
Show Gist options
  • Save feanor07/e852c425689b8588248dc08cd88e80b5 to your computer and use it in GitHub Desktop.
Save feanor07/e852c425689b8588248dc08cd88e80b5 to your computer and use it in GitHub Desktop.
stackoverflow question#43115171-solved
import Ember from 'ember';
export default Ember.Component.extend({
categories: {
'Bourbons': ['Bulleit', 'Four Roses', 'Woodford Reserve'],
'Ryes': ['WhistlePig', 'High West']
},
actions: {
additem() {
// A manual setting of the attribute causes the DOM to be updated
this.set('categories.foo', ['foo']);
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
{{my-component}}
<br>
<br>
{{#each-in categories as |category products|}}
<li>{{category}}
<ol>
{{#each products as |product|}}
<li>{{product}}</li>
{{/each}}
</ol>
</li>
{{/each-in}}
<button onclick={{action 'additem'}}>Add item to categories object</button>
{
"version": "0.12.1",
"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.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment