Skip to content

Instantly share code, notes, and snippets.

@robneville73
Last active August 9, 2017 13:57
Show Gist options
  • Save robneville73/40b7485d9578c1d17103c307614a8a83 to your computer and use it in GitHub Desktop.
Save robneville73/40b7485d9578c1d17103c307614a8a83 to your computer and use it in GitHub Desktop.
select-list
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
'clicked': function(item) {
alert(`got a click for ${item.productid}`);
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
lines: [
{productid: 'skua', qty: 1},
{productid: 'skub', qty: 3}
]
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{#select-list list=lines as |item|}}
{{order-line line=item}}<br>
{{/select-list}}
<br>
<br>
Product: {{line.productid}} -- Qty: {{line.qty}}
{{#each list as |item|}}
<div {{action 'clicked' item}}>
{{yield item}}
</div>
{{/each}}
{
"version": "0.12.1",
"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.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment