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('backpack').clear(); // []
hamster.get('hasStuff');         // false

Parameters:

dependentKey String

Returns:

Ember.ComputedProperty
computed property which returns true if original value for property is not empty.
doc_EmberJs
2016-11-30 16:51:18
Comments
Leave a Comment

Please login to continue.