Is there a way to validate a field in angular without using a directive? For example: I want to make following validation on an input field.
I'm surprised no one has mentioned ui-validate
$scope.isOdd = function($value){ return $value % 2; } ... {{myform.value.$error|json}}
{{myform.value.$error|json}}
Doesn't get any simpler than that, and it's PROPER AngularJS validation (not silly watches)
Here's a working demo