Angular 4: How to watch an object for changes?

后端 未结 6 813
死守一世寂寞
死守一世寂寞 2021-01-30 20:45

ETA: I know that there are various ways to watch my form for changes. That is not what I am trying to do. As the title says, I am asking how to watch for change

6条回答
  •  攒了一身酷
    2021-01-30 21:32

    visit https://github.com/cartant/rxjs-observe. it bases on rxjs and proxy.

    import { observe } from "rxjs-observe";
    
    const instance = { name: "Alice" };
    const { observables, proxy } = observe(instance);
    observables.name.subscribe(value => console.log(name));
    proxy.name = "Bob";
    

提交回复
热议问题