Skip to content

Instantly share code, notes, and snippets.

@thijsvdanker
Created March 21, 2016 15:18
Show Gist options
  • Save thijsvdanker/33ac989edcd605f5cced to your computer and use it in GitHub Desktop.
Save thijsvdanker/33ac989edcd605f5cced to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{my-component someOption="someValue" anotherOption="anotherValue"}}
{{outlet}}
<br>
<br>
import Ember from 'ember';
export default Ember.Component.extend({
passedItems: Ember.computed(function() {
console.log(this.attrs);
const attributeArray = $.map(this.attrs, function(value, index) {
return [{name: index, value: value}];
});
return attributeArray;
})
});
{{yield}}
<ul>
{{#each passedItems as |attribute|}}
<li>
{{{attribute.name}}}: {{{attribute.value}}}
</li>
{{/each}}
</ul>
{
"version": "0.6.5",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment