Using 'ng-messages' in a Repeater
ng-messages
is great for showing form errors. Here’s a contrived example:
Some nice validation, without having to write any JS code to make it happen. Nice, right?
But how about when you’re using a repeater? You need to use ng-repeat
’s built in
$index
variable for the name
attribute, and then in your ng-messages
attribute use array syntax instead
of dot syntax:
It’s a bit inelegant, but it seems to be the best way to do the job.