Angular 6 Material mat-select change method removed

后端 未结 5 920
小蘑菇
小蘑菇 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:10

    For:

    1) mat-select (selectionChange)="myFunction()" works in angular as:

    sample.component.html

     
         
           {{option}}
         
     
    

    sample.component.ts

    actions=['A','B','C'];
    onChange() {
      //Do something
    }
    

    2) Simple html select (change)="myFunction()" works in angular as:

    sample.component.html

    
    

    sample.component.ts

    onChange() {
      //Do something
    }
    

提交回复
热议问题