Ember.computed.readOnly()

readOnly (dependentKey) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/computed_macros.js:580 Available since 1.5.0 Where computed.oneWay provides oneWay bindings, computed.readOnly provides a readOnly one way binding. Very often when using computed.oneWay one does not also want changes to propagate back up, as they will replace the value. This prevents the reverse flow, and also throws an exception when it occurs. Example let User = Ember.Object.extend({ firs

Ember.computed.reads()

reads (dependentKey) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/computed_macros.js:568 This is a more semantically meaningful alias of computed.oneWay, whose name is somewhat ambiguous as to which direction the data flows. Parameters: dependentKey String Returns: Ember.ComputedProperty computed property which creates a one way computed property to the original value for property.

Ember.computed.oneWay()

oneWay (dependentKey) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/computed_macros.js:531 Where computed.alias aliases get and set, and allows for bidirectional data flow, computed.oneWay only provides an aliased get. The set will not mutate the upstream property, rather causes the current property to become the value set. This causes the downstream property to permanently diverge from the upstream property. Example let User = Ember.Object.extend({ firstName

Ember.computed.notEmpty()

notEmpty (dependentKey) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/computed_macros.js:87 A computed property that returns true if the value of the dependent property is NOT null, an empty string, empty array, or empty function. Example let Hamster = Ember.Object.extend({ hasStuff: Ember.computed.notEmpty('backpack') }); let hamster = Hamster.create({ backpack: ['Food', 'Sleeping Bag', 'Tent'] }); hamster.get('hasStuff'); // true hamster.get('back

Ember.computed.not()

not (dependentKey) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/computed_macros.js:152 A computed property that returns the inverse boolean value of the original value for the dependent property. Example let User = Ember.Object.extend({ isAnonymous: Ember.computed.not('loggedIn') }); let user = User.create({loggedIn: false}); user.get('isAnonymous'); // true user.set('loggedIn', true); user.get('isAnonymous'); // false Parameters: dependentKey String

Ember.computed.none()

none (dependentKey) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/computed_macros.js:118 A computed property that returns true if the value of the dependent property is null or undefined. This avoids errors from JSLint complaining about use of ==, which can be technically confusing. Example let Hamster = Ember.Object.extend({ isHungry: Ember.computed.none('food') }); let hamster = Hamster.create(); hamster.get('isHungry'); // true hamster.set('food', 'Banan

Ember.computed.min()

min (dependentKey) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/reduce_computed_macros.js:123 A computed property that calculates the minimum value in the dependent array. This will return Infinity when the dependent array is empty. let Person = Ember.Object.extend({ childAges: Ember.computed.mapBy('children', 'age'), minChildAge: Ember.computed.min('childAges') }); let lordByron = Person.create({ children: [] }); lordByron.get('minChildAge'); // Infinit

Ember.computed.match()

match (dependentKey, regexp) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/computed_macros.js:216 A computed property which matches the original value for the dependent property against a given RegExp, returning true if the value matches the RegExp and false if it does not. Example let User = Ember.Object.extend({ hasValidEmail: Ember.computed.match('email', /^.+@.+\..+$/) }); let user = User.create({loggedIn: false}); user.get('hasValidEmail'); // false us

Ember.computed.max()

max (dependentKey) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/reduce_computed_macros.js:78 A computed property that calculates the maximum value in the dependent array. This will return -Infinity when the dependent array is empty. let Person = Ember.Object.extend({ childAges: Ember.computed.mapBy('children', 'age'), maxChildAge: Ember.computed.max('childAges') }); let lordByron = Person.create({ children: [] }); lordByron.get('maxChildAge'); // -Infini

Ember.computed.map()

map (dependentKey, callback) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/reduce_computed_macros.js:168 Returns an array mapped via the callback The callback method you provide should have the following signature. item is the current item in the iteration. index is the integer index of the current item in the iteration. function(item, index); Example let Hamster = Ember.Object.extend({ excitingChores: Ember.computed.map('chores', function(chore, index) {