Closed paolosanchi closed 9 years ago
ps.. why we just don't check $touched instead of using a blur event? Angular provide every state of the control we need
There's usually an action on the controller that is called when a form is submitted, so I recommend performing the scope.$broadcast('show-errors-check-validity')
within the controller. I'm leery of performing that validation automatically on form submit because there might be some users that don't want that functionality.
And the reason this directive is using the blur
event instead of $touched
is because Angular version 1.2 does not have $touched
. That was introduced in version 1.3, and I don't want to add it now because the directive could no longer be used in Angular 1.2 apps.
On submit of the form, the control shoould be validated, even if they didn't blur. So I propose to add this $watch:
i've tested it, and it seems to work