Function

Module: @ember/object
import { alias } from '@ember/object/computed';
dependentKey
String
returns
ComputedProperty
computed property which creates an alias to the original value for property.

Creates a new property that is an alias for another property on an object. Calls to get or set this property behave as though they were called on the original property.

Example:

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

class Person {
  name = 'Alex Matchneer';

  @alias('name') nomen;
}

let alex = new Person();

alex.nomen; // 'Alex Matchneer'
alex.name;  // 'Alex Matchneer'

set(alex, 'nomen', '@machty');
alex.name;  // '@machty'