Why the following codes are not equivalent?
With 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');
}),
With alias:
computed: Ember.computed.alias('selected'),
observer1: Ember.observer('computed', function() {
console.log('observer1');
}),
observer2: Ember.observer('selected', function() {
console.log('observer2');
}),
The first one only prints observer2
and the second one prints observer1
and observer2
.
Aucun commentaire:
Enregistrer un commentaire