The (ngModelChange)
event does not fire when I clear all values from input field by using Ctrl.A
or paste a value into it.
<input pInputText (ngModelChange)="IsElementDataMissingForMultiValue(languages.TranslationValue)"
[(ngModel)]="languages.TranslationValue" type="text" />
function Controller()
{
function IsElementDataMissingForMultiValue(value)
{
alert(value)
}
}
The (ngModelChange)
event triggers when I remove values one by one or add values one by one. But it does not trigger when removing all values by using Ctrl+A
or pasting values by using Ctrl+V
.
It's my mistake.
The problem occurred when I does not assign $event
to ngModel
object in some event's
This below code does not working
(ngModelChange)="IsElementDataMissingForMultiValue(languages.TranslationValue)"
But the below code working like a charm!.
(ngModelChange)="languages.TranslationValue = $event;
IsElementDataMissingForMultiValue(languages.TranslationValue)"
I hope this may be helps others.