md-select 上的更改功能不起作用?角度2

change function on md-select doesn't work? angular2

这是html:

<md-select placeholder="Veileder {{i+1}}" (change)="updateSupervisorList(i)">
            <md-option *ngFor="let supervisor of displayedsupervisorList" >{{supervisor}}</md-option>
          </md-select>

这是.ts文件中的方法(displayedsupervisorList是一个带名字的string[])

updateSupervisorList(i: number){
  console.log("updatesupervisorlist");
  this.displayedsupervisorList.splice(i,1);
}

当我选择一个选项时没有任何反应,它甚至没有转到 console.log

事件 change 不起作用,但您可以在 [=29 上使用 select 方法=].

Here 您可以从 angular-material 中找到 md-select 的文档。 在 API 参考选项卡中 描述了 md-select 和 md-option 组件的所有方法和参数

希望对你有所帮助

这应该有效:

<md-select placeholder="Veileder {{i+1}}" 
  ngModel (ngModelChange)="updateSupervisorList(i)" name="veileder">