Reputation: 6632
I know how to do one off validations in angular. What I am looking to do is to display a warning at the top of the page if any errors exist in the below forms that were trying to submit. How do I accomplish this?
Is there a form.$errors? For if any error occurs on the page?
So can I do something like this?
<div id="errorInfoHeader" ng-show="formName.$errors">
Upvotes: 0
Views: 626
Reputation: 1018
Yes, you're on the right track:
formName.$invalid
is what you're looking for.
<div id="errorInfoHeader" ng-show="formName.$invalid">
See this plunkr that demonstrates what you're trying to do: http://plnkr.co/edit/9Ny58FY9rv74sxXryKmh?p=preview
Upvotes: 4
Reputation: 791
You can use $valid
like this:
<div id="errorInfoHeader" ng-show="formName.$valid">
Upvotes: 1