Skip to content

Instantly share code, notes, and snippets.

@GavinJoyce
Forked from paddyobrien/components.my-component.js
Last active February 4, 2017 21:07
Show Gist options
  • Save GavinJoyce/61cf80cb5c1ee8151458fbb45145c6a5 to your computer and use it in GitHub Desktop.
Save GavinJoyce/61cf80cb5c1ee8151458fbb45145c6a5 to your computer and use it in GitHub Desktop.
closure component bug?
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
p {
background-color: lightyellow;
}
<p>using the component helper works when in a hash, but not when it's a named param:</p>
<hr />
{{outer-component
componentOnItsOwn=(component 'inner-component')
componentInAHash=(hash component=(component 'inner-component'))}}
<hr />
<p>it also doesn't work when using the `with` helper</p>
{{#with (component 'inner-component') as |inner|}}
{{inner}}
{{/with}}
<p>It does work if you use the component helper (twice)</p>
{{#with (component 'inner-component') as |inner|}}
{{component inner}}
{{/with}}
<p>Again, it does when wrapping with the `hash` helper</p>
{{#with (hash inner=(component 'inner-component')) as |components|}}
{{components.inner}}
{{/with}}
This was passed in inside a hash:<br/>
{{componentInAHash.component}}
<hr />
This was passed in as a named param:<br/>
{{componentOnItsOwn}}
{
"version": "0.11.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": "canary",
"ember-data": "2.11.0",
"ember-template-compiler": "canary",
"ember-testing": "canary"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment