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', 'Banana');
hamster.get('isHungry'); // false
hamster.set('food', null);
hamster.get('isHungry'); // true

Parameters:

dependentKey String

Returns:

Ember.ComputedProperty
computed property which returns true if original value for property is null or undefined.
doc_EmberJs
2016-11-30 16:51:17
Comments
Leave a Comment

Please login to continue.