What causes the discrepancy between the two sets of code?
Utilizing computed:
computed: Ember.computed('selected', function() {
console.log('computed');
return this.get('selected');
}),
observer1: Ember.observer('computed', function() {
console.log('observer1');
}),
observer2: Ember.observer('selected', function() {
console.log('observer2');
}),
Using alias instead:
computed: Ember.computed.alias('selected'),
observer1: Ember.observer('computed', function() {
console.log('observer1');
}),
observer2: Ember.observer('selected', function() {
console.log('observer2');
}),
The former only displays observer2
, while the latter showcases both observer1
and observer2
.