Last active
August 8, 2018 14:27
-
-
Save manufitoussi/62b2568f5b4356598bb892c5a35b5eec to your computer and use it in GitHub Desktop.
New Twiddle
This file contains hidden or 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'; | |
var MyObj = Ember.Object.extend({ | |
value: null, | |
depends: null, | |
value2: Ember.computed('depends', { | |
get() { | |
var depends = this.get('depends') || {}; | |
return Ember.computed(...Object.keys(depends).map(d=> `depends.${d}`), { | |
get() { | |
return Object.values(depends); | |
} | |
} | |
); | |
} | |
}), | |
init() { | |
this._super(); | |
var depends = this.get('depends') || {}; | |
/*this.set('value', Ember.computed(...Object.keys(depends).map(d=> `depends.${d}`), { | |
get() { | |
return Object.values(depends); | |
} | |
} | |
));*/ | |
Ember.defineProperty(this, 'value', Ember.computed(...Object.keys(depends).map(d=> `depends.${d}`), { | |
get() { | |
return Object.values(depends); | |
} | |
} | |
)); | |
} | |
}); | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
obj: MyObj.create({depends: {coco: 'coco', test: 'test'}}), | |
actions:{ | |
change() { | |
this.set('obj.depends.coco', 'salut!'); | |
} | |
} | |
}); |
This file contains hidden or 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.15.0", | |
"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.2.2", | |
"ember-template-compiler": "3.2.2", | |
"ember-testing": "3.2.2" | |
}, | |
"addons": { | |
"ember-data": "3.2.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment