Ember.computed.bool()

bool (dependentKey) Ember.ComputedPropertypublic

Defined in packages/ember-runtime/lib/computed/computed_macros.js:183

A computed property that converts the provided dependent property into a boolean value.

let Hamster = Ember.Object.extend({
  hasBananas: Ember.computed.bool('numBananas')
});

let hamster = Hamster.create();

hamster.get('hasBananas'); // false
hamster.set('numBananas', 0);
hamster.get('hasBananas'); // false
hamster.set('numBananas', 1);
hamster.get('hasBananas'); // true
hamster.set('numBananas', null);
hamster.get('hasBananas'); // false

Parameters:

dependentKey String

Returns:

Ember.ComputedProperty
computed property which converts to boolean the original value for property
doc_EmberJs
2016-11-30 16:51:12
Comments
Leave a Comment

Please login to continue.