Hi Sander,
I am actually not adding anything to a primitive string (the index is 1).
This is my fault for not setting the new String('Orange') in a separate
variable.
I actually fixed the problem when I realised that I can simply put the
validation against ngModel itself:-
http://plnkr.co/edit/XpRpdl4fJVxsdgmBqIjl?p=preview
It works well and works with the ng-repeater.
I tried to use validators, but I found that it didn't work with values in
the repeater:-
http://plnkr.co/edit/MbPFimytfnwOfnTvukRi?p=preview
Once again, not sure why.
On Thursday, 13 November 2014 16:44:27 UTC+11, Sander Elias wrote:
>
> Hi Kamal,
>
> Ok, I think the base of your problem is that you use a string as an object.
> this is from your code:
>
> $scope.data.repeatingValues = [ 'apple', new String('Orange') ];
> $scope.data.repeatingValues[1].$$error = "Some repeating error";
>
> during run-time this translated roughly into: "apple".$$error='Some..'.
> I’m not sure if that’s a good idea.
>
> Why don’t you just push an custom validator to the ngModel.$validators?
> <https://docs.angularjs.org/api/ng/type/ngModel.NgModelController>?
>
> Regards
> Sander
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.