I want to create class property decorator which will look for all changes of this property and do some stuff. How can i do that?
In RxJs i found ofObjectChanges
method
https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/ofobjectchanges.md
but looks like that method does not exist in angular2 RxJs version.
That method must trigger on changes of object, for example with Array.push();
You're right, there's no (yet?) implementation of that method in RxJs 5 beta currently used in Angular 2: Migrating from RxJs 4 to 5. But it is not actually clear if you really need it.
If you use typescript then you can see about writing decorators here. Also, you can look into angular's sources, kind of starting point is modules/@angular/core/src/metadata/directives.ts. You can see how angular team implemented @Input() decorator and figure out how to do it in your case which sounds pretty similar to me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With