How can I override Angular's filtering of invalid form values, forcing Angular to persist the $viewValue to $modelValue?

前端 未结 4 2124
终归单人心
终归单人心 2020-12-31 12:54

I need to be able to temporarily persist data that isn\'t fully validated yet, then enforce validation when I\'m ready to make it permanent. But Angular is preventing that.

4条回答
  •  萌比男神i
    2020-12-31 13:45

    make sure you are injecting $scope on that controller initialization, because i got same issue with typeahead auto complete, i fix this issue by set validity on saving as below:

     if (!self.editForm.$valid && self.editForm.txtCustomer.$invalid) {//workaround to fix typeahead validation issue.
                    self.editForm.txtCustomer.$setValidity('editable', true);
                }
    

提交回复
热议问题