Is is possible to disable a button in a form, when there is any error message in the form other than built in errors such as 'required', 'min-length', such as validating a condition?
Hope the following helps
$scope.formName.$setValidity('errName', false);
, then you can use formName.$error.errName
as a condition in ng-disabledIn JS,
$scope.formName.$setValidity('errName', false);//invalidate the form
You can set the error to true when needed.
In HTML,
<button type="button" ng-disabled="formName.$error.err">Button</button>
In JS,
$scope.disableBtn = true; //whenever button is to be disabled.
In HTML,
<button type="button" ng-disabled="disableBtn">Button</button>
UPDATE: Adding plunker link https://plnkr.co/edit/5CFpFMAnZ8kkBh5z5vH4?p=preview