Form Validation with Dependent Fields in AngularJS

前端 未结 2 646
执念已碎
执念已碎 2021-01-12 16:54

I have an object that has 2 fields, while 1 should be less than or equal to another.

Say it\'s HDD quota settings and I need the threshold to be less th

2条回答
  •  攒了一身酷
    2021-01-12 17:18

    Better late than never, you need to add ng-model-options="{allowInvalid:true}" to your form input elements to stop this happening - the problem is that when a promise is rejected (e.g. using $q or $http) the model, by default, is not updated. Crazy huh! Cost me a day working this out.

    I have written a plunkr specifically for this problem - Trust me this code is good ... http://embed.plnkr.co/xICScojgmcMkghMaYSsJ/preview

提交回复
热议问题