Function
equal (dependentKey, value) ComputedProperty public
Module: | @ember/object |
---|
Defined in packages/ember-runtime/lib/computed/computed_macros.js:265
import { equal } from '@ember/object/computed';
- dependentKey
- String
- value
- String|Number|Object
- returns
- ComputedProperty
- computed property which returns true if the original value for property is equal to the given value.
A computed property that returns true if the provided dependent property is equal to the given value.
Example
let Hamster = Ember.Object.extend({ satisfied: Ember.computed.equal('percentCarrotsEaten', 100) }); let hamster = Hamster.create(); hamster.get('satisfied'); // false hamster.set('percentCarrotsEaten', 100); hamster.get('satisfied'); // true hamster.set('percentCarrotsEaten', 50); hamster.get('satisfied'); // false
© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/2.18/functions/@ember%2Fobject%2Fcomputed/equal