NgModelChange在禁用的输入上不起作用

时间:2019-05-24 07:28:57

标签: angular7 angular-ngmodelchange

我想在禁用的输入上触发ngModelChange事件。但这不起作用

我尝试了以下操作:

//demo.component.html

<input  matInput name="A" #A="ngModel" 
[(ngModel)]="A" placeholder="Enter A" 
ngModel (keyup)="EventA($event,i,A)">

<input  matInput name="B" #B="ngModel" 
[(ngModel)]="B" placeholder="Enter B" 
ngModel (keyup)="EventB($event,i,B)">

<input  matInput name="C" #C="ngModel" 
[(ngModel)]="C" placeholder="Enter C" disabled 
ngModel (ngModelChange)="EventB($event,i,B)">

//demo.component.ts

EventA(i, a: NgModel) {
   this.C = 10;      //here value of C (ngModel) is changed. but ngModelChange did not get fired
}

EventB(i, a: NgModel) {
   //Some Code
}

我想要什么?

当A的值由于事件'keyup'而改变时,C的值将改变,然后我要触发ngModelChange Event即EventB。

请帮助我解决问题

0 个答案:

没有答案