Ember.computed.alias()

alias (dependentKey) Ember.ComputedPropertypublic

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

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.

let Person = Ember.Object.extend({
  name: 'Alex Matchneer',
  nomen: Ember.computed.alias('name')
});

let alex = Person.create();

alex.get('nomen'); // 'Alex Matchneer'
alex.get('name');  // 'Alex Matchneer'

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

Parameters:

dependentKey String

Returns:

Ember.ComputedProperty
computed property which creates an alias to the original value for property.
doc_EmberJs
2016-11-30 16:51:11
Comments
Leave a Comment

Please login to continue.