Finding the RxJsObjectChanges Method Analog in Angular 2

I want to create a class property decorator that will look for all changes to this property and do some things. How can i do this?

In RxJs, I found the ofObjectChanges method https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/ofobjectchanges.md

but it looks like this method does not exist in the angular2 version of RxJs.

This method should be launched when the object changes, for example, using Array.push ();

+7
angular rxjs
source share
1 answer

You are right, there is no (yet?) Implementation of this method in RxJs 5 beta, which is currently used in Angular 2: Migration from RxJs 4 to 5 . But it’s actually not clear whether you really need it.

If you use typescript, you can see about writing decorators here . Alternatively, you can explore Angular sources, the starting point is the module /@angular/core/src/metadata/directives.ts. You can see how the Angular team implemented the @Input () decorator and figured out how to do this in your case, which sounds pretty similar to me.

+1
source share

All Articles