Skip to content

Instantly share code, notes, and snippets.

@iStefo
Created January 27, 2017 11:26
Show Gist options
  • Save iStefo/208688934ca9599e8607045d3e067fde to your computer and use it in GitHub Desktop.
Save iStefo/208688934ca9599e8607045d3e067fde to your computer and use it in GitHub Desktop.
array-hash-fixed
import Ember from 'ember';
export default Ember.Component.extend({
totalLength: Ember.computed('[email protected]', function() {
// doesn't matter, won't compute anyway
return -1;
})
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export function myHash(params, hash) {
return Object.assign({}, hash);
}
export default Ember.Helper.helper(myHash);
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{my-component data=(array
(my-hash name="Stefan")
(my-hash name="Chris")
)}}
<br>
<br>
<ul>
{{#each data as |item|}}
<li>{{item.name}}</li>
{{/each}}
</ul>
Total Length: {{totalLength}}
{
"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": "2.10.2",
"ember-data": "2.11.0",
"ember-template-compiler": "2.10.2",
"ember-testing": "2.10.2"
},
"addons": {
"ember-composable-helpers": "1.1.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment