Skip to content

Instantly share code, notes, and snippets.

@feanor07
Created April 13, 2017 11:40
Show Gist options
  • Save feanor07/3c4b2734fa0dadfab477a9c5b98a9fa2 to your computer and use it in GitHub Desktop.
Save feanor07/3c4b2734fa0dadfab477a9c5b98a9fa2 to your computer and use it in GitHub Desktop.
so#43391089
import Ember from 'ember';
export default Ember.Controller.extend({
selectedService: [],
services: [{name:'First Service'},{name: 'Second Service'},{name: 'Third Service'}],
actions: {
setValue(ser){
this.get('selectedService').pushObject(ser);
}
}
});
<div class="panel-body">
<div class="form-group">
<select name="services" id="services" class="form-control" onchange={{action 'setValue' value="target.value"}}>
<option> Select Services </option>
{{#each services as |service|}}
<option value="{{service.name}}">{{service.name}}</option>
{{/each}}
</select>
</div>
<div class="form-group">
{{#each selectedService as |selection index|}}
<span class="label label-primary">{{index}} {{selection}}</span>
<br>
{{/each}}
</div>
</div>
{
"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