-
-
Save stefanpenner/a3109c04e37211cd8dc8 to your computer and use it in GitHub Desktop.
New Twiddle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
function optionsProperty(dependentKey) { | |
return Ember.computed(dependentKey, function() { | |
return this.get(dependentKey).split(',').map(Function.prototype.call, String.prototype.trim); | |
}); | |
} | |
export default Ember.Controller.extend({ | |
init() { | |
this._super(...arguments); | |
this.get('values'); // initialize values CP | |
}, | |
options: 'Red, Green, Blue', | |
values: optionsProperty('options'), | |
valuesChanged: false, | |
valuesDidChange: Ember.observer('values.[]', function() { | |
console.log('valuesDidChange', this.get('allValues')); | |
this.set('valuesChanged', true); | |
}) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.4.10", | |
"dependencies": { | |
"lodash": "https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.js", | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.9/ember.debug.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.11/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.9/ember-template-compiler.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment