假设我有一个行为主体,它的值由一个具有两个属性的对象组成.有没有办法只订阅基础值的一个属性的更改?
export interface MyObject {
property1: string,
property2: string
};
const subject = new BehaviorSubject<MyObject>({
property1: 'test',
property2: 'test'
});
subject.next({
property1: 'test',
property2: 'test2'
});
subject.subscribe(value => {
// how to only fire for changes on property2?
});