Function
empty (dependentKey) ComputedProperty public
Module: | @ember/object |
---|
Defined in packages/ember-runtime/lib/computed/computed_macros.js:58
Available since v1.6.0
import { empty } from '@ember/object/computed';
- dependentKey
- String
- returns
- ComputedProperty
- computed property which returns true if the value of the dependent property is null, an empty string, empty array, or empty function and false if the underlying value is not empty.
A computed property that returns true if the value of the dependent property is null, an empty string, empty array, or empty function.
Example
let ToDoList = Ember.Object.extend({ isDone: Ember.computed.empty('todos') }); let todoList = ToDoList.create({ todos: ['Unit Test', 'Documentation', 'Release'] }); todoList.get('isDone'); // false todoList.get('todos').clear(); todoList.get('isDone'); // true
© 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/empty