I am quite new to RxJS so I apologize in advance if this has been answered already.
I have an Angular 2 application and in one of the components I have a plain object. I am binding the UI to this object. What I would like to do is to be able to capture all changes to this object regardless if they come from code or from the user changing one of the fields.
I was looking at the observable object but it seems that the subscribers can only receive notifications if the new is pushed via the Emit method. How would this work in the case of a property bound to a input field for example?
Is there a better way of doing this?
Here is what my code looks like:
export class MyComponent {
app: ApplicationModel = new ApplicationModel(); <--- this is the object I want to track
constructor(api: APIService) {
api.getApplication().then((data) => {
this.app = data;
});
}
}
I am looking for something similar to the way Knockout allows you to receive change notifications:
myViewModel.personName.subscribe(function(newValue) {
alert("The person's new name is " + newValue);
});
Thank you.