Last active
April 19, 2016 10:16
-
-
Save onechiporenko/54f985ac429ebc1584a7cd336790882c to your computer and use it in GitHub Desktop.
Ember.computed.* with braces
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'; | |
const {and, or} = Ember.computed; | |
export default Ember.Controller.extend({ | |
appName: 'Ember.computed.* with braces', | |
emberVersion: Ember.VERSION, | |
obj: { | |
a: true, | |
b: false | |
}, | |
objStringify: Ember.computed('obj.{a,b}', function () {return JSON.stringify(this.get('obj'), null, 2);}), | |
computedOr: or('obj.a', 'obj.b'), | |
computedOrWithBraces: or('obj.{a,b}'), | |
computedAnd: and('obj.a', 'obj.b'), | |
computedAndWithBraces: and('obj.{a,b}'), | |
actions: { | |
toggle (field) { | |
this.toggleProperty(`obj.${field}`); | |
} | |
} | |
}); |
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.7.2", | |
"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.4.4", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.3/ember-data.js", | |
"ember-template-compiler": "2.4.4" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment