Angular 6 Material mat-select change method removed

后端 未结 5 943
小蘑菇
小蘑菇 2020-12-07 19:39

In Angular Material Design 6, the (change) method was removed. I cant find how to replace the change method to execute code in the component when the user change selection

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-07 20:09

    If you're using Reactive forms you can listen for changes to the select control like so..

    this.form.get('mySelectControl').valueChanges.subscribe(value => { ... do stuff ... })
    

提交回复
热议问题