Skip to content

Instantly share code, notes, and snippets.

@timrwood
Created December 30, 2019 18:24
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 timrwood/6bae15a5a73cc9c6272ef9083439c2ee to your computer and use it in GitHub Desktop.
Save timrwood/6bae15a5a73cc9c6272ef9083439c2ee to your computer and use it in GitHub Desktop.
each-in
import Ember from 'ember';
import { computed } from '@ember/object'
export default Ember.Controller.extend({
people: {
'Mr. Chris': ['foo', 'bar'],
'Mr. Tim': ['fiz', 'baz']
},
people2: computed(function(){
const out = {}
out['Mr. Chris'] = ['foo']
out['Mr. Chris'].pushObject('bar')
out['Mr. Tim'] = ['fiz']
out['Mr. Tim'].pushObject('baz')
return out
})
});
{{#each-in people as |name things|}}
{{name}}
{{#each things as |thing|}}
<br />{{thing}}
{{/each}}
<hr />
{{/each-in}}
{{#each-in people2 as |name things|}}
{{name}}
{{#each things as |thing|}}
<br />{{thing}}
{{/each}}
<hr />
{{/each-in}}
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.12.0",
"ember-template-compiler": "3.12.0",
"ember-testing": "3.12.0"
},
"addons": {
"ember-data": "3.12.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment