Function

Module: @ember/object
path
String
zero or more property paths
returns
ComputedProperty
this

Sets the dependent keys on this computed property. Pass any number of arguments containing key paths that this computed property depends on.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import EmberObject, { computed } from '@ember/object';

let President = EmberObject.extend({
  fullName: computed('firstName', 'lastName', function() {
    return this.get('firstName') + ' ' + this.get('lastName');

    // Tell Ember that this computed property depends on firstName
    // and lastName
  })
});

let president = President.create({
  firstName: 'Barack',
  lastName: 'Obama'
});

president.get('fullName'); // 'Barack Obama'