Skip to content

Instantly share code, notes, and snippets.

@Panman82
Last active October 4, 2016 19:28
Show Gist options
  • Save Panman82/24f1983de422ed7039c5b21af68cc032 to your computer and use it in GitHub Desktop.
Save Panman82/24f1983de422ed7039c5b21af68cc032 to your computer and use it in GitHub Desktop.
Block params named component bug
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
components: ['foo','bar','baz']
});
<h1>Welcome to {{appName}}</h1>
<p>
Bug with block params named `component`
and trying to use it as an HTML attribute.
Inspect the HTML elements for the `data-value` attribute.
</p>
<h4>each as |abc|</h4>
<ul>
{{#each components as |abc|}}
<li>{{abc}}</li>
{{/each}}
</ul>
<h4>each as |component|</h4>
<ul>
{{#each components as |component|}}
<li>{{component}}</li>
{{/each}}
</ul>
<h4>each as |component| <em>in attribute</em></h4>
<ul>
{{#each components as |component index|}}
<li data-value="{{component}}">{{index}}</li>
{{/each}}
</ul>
{
"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": "beta",
"ember-data": "beta",
"ember-template-compiler": "beta",
"ember-testing": "beta"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment