no-observers
Usage of observers is very easy BUT it leads to hard to reason about consequences. Unless observers are necessary, it's better to avoid them.
{{input value=text key-up="change"}}
// GOOD
export default Controller.extend({
actions: {
change() {
console.log(`change detected: ${this.get('text')}`);
},
},
});
// BAD
export default Model.extend({
change: Ember.observer('text', function() {
console.log(`change detected: ${this.get('text')}`);
},
});
## Don't use observers ### Rule name: `no-observers` Usage of observers is very easy **BUT** it leads to hard to reason about consequences. Unless observers are necessary, it's better to avoid them. ```hbs {{input value=text key-up="change"}} ``` ```javascript // GOOD export default Controller.extend({ actions: { change() { console.log(`change detected: ${this.get('text')}`); }, }, }); // BAD export default Model.extend({ change: Ember.observer('text', function() { console.log(`change detected: ${this.get('text')}`); }, }); ```