4 ms·
Their observations especially on Observables is very spot-on. We have quite a few "makeObservable(input)" in our code to make @Inputs observable. That the frame
by foepys 6y ago
Their observations especially on Observables is very spot-on. We have quite a few "makeObservable(input)" in our code to make @Inputs observable. That the framework doesn't do it automatically is a bit of a let down.
Same about Reactive Forms.
Patching each @Output and @Input through a component by hand is also pretty annoying, especially if they change relatively often. A custom input field for a reactive form gets quite large due to all the in- and outputs.
- geewee 6y agoIs there a good implementation of makeObservable() somewhere? I haven't been able to find one that seemed to work elegantly. Patching @Output and @Input is supremely painful - I really wish there was some sort of shorthand for that.
- foepys 6y agoI cannot share the code we use directly but we use Object.defineProperty and override the getter and setter for it, tunneling the new setted value through a behavior subject that gets returned. The getter returns the value by synchronous access to the subject. Inputs into makeObservable are the component class (this) and the requested property name (generics with keyof).
- geewee 6y agoOh that's a clever way of doing it. Thanks!