Problem
Ember.alias fails unexpectedly in some cases. For example, it cannot be used to alias a property that will be defined later. e.g.
Ember.ControllerMixin.reopen({
model: Ember.alias('content')
});
controller = Ember.Controller.create({
content: 'foo'
});
controller.get('model') //=> undefined
This is due to Alias descriptors being processed when mixins are merged (see 'followAlias' here) and after discussing with @kselden and @stefanpenner there does not seem to be a good way to make this work as expected while also supporting Ember.alias ability to alias method names.
Solution
To address this, we propose adding deprecation warnings to Ember.alias and introducing two new methods:
Ember.computed.alias(propertyPath)
Synthesizes a computed property dependent on the propertyPath and returning the value of the propertyPath. In the future, this could potentially be optimized in certain cases by reusing the descriptor of the target property.
Ember.aliasMethod(methodName)
Synthesizes a method pointing to the specified method.
Problem
Ember.aliasfails unexpectedly in some cases. For example, it cannot be used to alias a property that will be defined later. e.g.This is due to Alias descriptors being processed when mixins are merged (see 'followAlias' here) and after discussing with @kselden and @stefanpenner there does not seem to be a good way to make this work as expected while also supporting
Ember.aliasability to alias method names.Solution
To address this, we propose adding deprecation warnings to
Ember.aliasand introducing two new methods:Ember.computed.alias(propertyPath)
Synthesizes a computed property dependent on the propertyPath and returning the value of the propertyPath. In the future, this could potentially be optimized in certain cases by reusing the descriptor of the target property.
Ember.aliasMethod(methodName)
Synthesizes a method pointing to the specified method.