Skip to content

Instantly share code, notes, and snippets.

@rwjblue
Forked from poteto/controllers.application.js
Created September 23, 2016 01:23
Show Gist options
  • Save rwjblue/9ccd2eb7e6945d039975f6429c46ef5a to your computer and use it in GitHub Desktop.
Save rwjblue/9ccd2eb7e6945d039975f6429c46ef5a to your computer and use it in GitHub Desktop.
each-in contextual components
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<ol>
<li>Pass in a hash of components</li>
<li>Use each-in to iterate over hash to render each closure component</li>
<li>Should this work?</li>
</ol>
<br>
<br>
This doesn't:
{{x-pluggable-each children=(hash
x-foo=(component "x-foo")
x-bar=(component "x-bar")
x-baz=(component "x-baz"))
}}
<hr>
This works fine as expected:
{{x-pluggable-string children=(hash
x-foo="x-foo"
x-bar="x-bar"
x-baz="x-baz")
}}
<hr>
This also works fine as expected:
{{x-pluggable-no-each children=(hash
x-foo=(component "x-foo")
x-bar=(component "x-bar")
x-baz=(component "x-baz"))
}}
{{#each-in children as |title x-child|}}
<p>{{title}} - {{component x-child}}</p>
{{/each-in}}
{{children.x-foo}}
{{children.x-bar}}
{{children.x-baz}}
{{#each-in children as |title x-child|}}
<p>{{title}} - {{component x-child}}</p>
{{/each-in}}
{
"version": "0.10.5",
"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.8.0",
"ember-data": "2.8.0",
"ember-template-compiler": "2.8.0",
"ember-testing": "2.8.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment