Should we use ng-blur with ng-change?

I have a problem with AngularJS ng-changeand ng-blurtherefore I want to confirm with an expert that this is the right way to use them when we update the form value.

  • I have a dropdown in the code below, and I want to execute overrideBusinessDec()when the user changes the value of the dropdown. With the current implementation, due ng-blur, this happens when we wring out the form. I can make a quick fix by deleting ng-blurfrom the field and it will work as expected.
  • Another scenario: when you are in the editing state, it fills in the values, but does not include the form if I do not add ng-blurto the field. I do not know how to fix this.

Is there a solution that can solve both problems?

<!-- main.html -->
<div>
    <select kendo-drop-down-list k-data-value-field="'id'"
        k-data-text-field="'text'" k-option-label="'Select'"
        k-data-source="ctrlEffOptions"
        ng-disabled="!processRating.controlEffectivenessRatingComputeKey"
        ng-model="processRating.controlEffectivenessRatingOverrideKey"
        ng-change="overrideBusinessDec()" id="controlEffBusiness" required ng-model-options="{updateOn: 'blur'}">
    </select>
</div>
+4
1

ng-change , . , , - , , . , on-blur, , .

on-blur , . - , .

+5

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


All Articles