Angular 4: How to watch an object for changes?

后端 未结 6 990
死守一世寂寞
死守一世寂寞 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:29

    I need to subscribe directly to changes on the model.

    Then you need to listen to model changes with ngModelChange

    Template:

    
    

    Class:

    doSomething(event) {
      console.log(event); // logs model value
    }
    

    DEMO

提交回复
热议问题