Ember.computed.equal()

equal (dependentKey, value) Ember.ComputedPropertypublic

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

A computed property that returns true if the provided dependent property is equal to the given value.

Example

let Hamster = Ember.Object.extend({
  napTime: Ember.computed.equal('state', 'sleepy')
});

let hamster = Hamster.create();

hamster.get('napTime'); // false
hamster.set('state', 'sleepy');
hamster.get('napTime'); // true
hamster.set('state', 'hungry');
hamster.get('napTime'); // false

Parameters:

dependentKey String
value String|Number|Object

Returns:

Ember.ComputedProperty
computed property which returns true if the original value for property is equal to the given value.
doc_EmberJs
2016-11-30 16:51:13
Comments
Leave a Comment

Please login to continue.