Skip to content

Instantly share code, notes, and snippets.

@jelhan
Created March 8, 2019 22:08
Show Gist options
  • Save jelhan/c3006689d5e9f512d74a2614a5c424e1 to your computer and use it in GitHub Desktop.
Save jelhan/c3006689d5e9f512d74a2614a5c424e1 to your computer and use it in GitHub Desktop.
ember-bootstrap-issue-769
import Ember from 'ember';
import { computed } from '@ember/object';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
moveTypeOptions: computed(function() {
return [{
value: 0,
label: "I've dropped a GeoKret"
}, {
value: 1,
label: "I've grabbed a GeoKret"
}, {
value: 3,
label: "I've met GeoKret"
}, {
value: 5,
label: "I've dipped a GeoKret"
}, {
value: 2,
label: "Comment"
}];
}),
selectedOption: computed('type', {
get() {
return this.moveTypeOptions.findBy('value', this.type);
},
set(key, selectedOption) {
this.set('type', selectedOption.value);
return selectedOption;
}
}),
type: 0,
});
<h1>Welcome to {{appName}}</h1>
type: {{type}}
<br><br>
{{#bs-form model=this as |form|}}
{{form.element
controlType="radio"
label="Move type"
options=moveTypeOptions
optionLabelPath="label"
property="selectedOption"
}}
{{/bs-form}}
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-bootstrap": "2.6.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment