The ng-change event does not fire to enter text in bootstrap modal

I'm kinda stuck here. I have an application that uses bootstrap modal with a couple of text fields that have values ​​from the server. When I first open the modal mode and delete items from the text box, the change event changes. Once all the fields are cleared, I closed the modal. When I opened the modal again, it is populated with new values, but when I remove an item from the text field, the ng-change event does not fire.

But here I found another strange thing, the above problem arises only if we have one element in the text box.

Here is my html code:

<tr>
  <td>
    <input only-numeric class="floatLeft" name="scoreSample" type="text" ng-model="scoreSample" id="scoreSample" ng-change="sampleMethod()" ng-model-onblur>
  </td>
  <td>
    <input only-numeric class=" floatLeft" name="errorSample" type="text" ng-model="errorSample" id="errorSample" ng-change="sampleMethod()" ng-model-onblur>
  </td>
</tr>

AngularJS Code:

$scope.sampleMethod = function () {
  alert("Coming here");
}

Thanks in advance.

+4
1

:


ngChange , .

:

, $parsers,

,

, : ngModel.


? , , , .

+1

Source: https://habr.com/ru/post/1527914/


All Articles