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.or()

or (dependentKey) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/computed_macros.js:464 A computed property which performs a logical or on the original values for the provided dependent properties. You may pass in more than two properties and even use property brace expansion. The computed property will return the first truthy value or last falsy value just like JavaScript's || operator. Example let Hamster = Ember.Object.extend({ readyForRain: Ember.computed.

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.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.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.mapBy()

mapBy (dependentKey, propertyKey) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/reduce_computed_macros.js:208 Returns an array mapped to the specified key. let Person = Ember.Object.extend({ childAges: Ember.computed.mapBy('children', 'age') }); let lordByron = Person.create({ children: [] }); lordByron.get('childAges'); // [] lordByron.get('children').pushObject({ name: 'Augusta Ada Byron', age: 7 }); lordByron.get('childAges'); // [7] lordByron.get('child