how to add multiple pattern validation for single input control.

5,556 views
Skip to first unread message

balamurugan r

unread,
Jun 19, 2014, 7:18:22 AM6/19/14
to ang...@googlegroups.com
Hi guys,

In my requirement, i need to validate the text entered by the user in the input element for below scenarios.

Input Type should be Text , and validation should be performed for number. We dont want that to be number type because it renders in different style in different browsers. And we want too support IE8 & IE7 as well..

value                                     error message       implementation                                                                              
""                                         This is required       required attribute 
NonAlphanumeric                  Invalid                    ng-pattern (Regex Pattern for numbers)
0                                          Should not be 0      ?????? 

is it possible to specify more patterns for single input ??
Actually i need two different error message for same input ??

How this can be achieved with multiple patterns ??

Thanks in advance

balamurugan r

unread,
Jun 20, 2014, 5:08:25 AM6/20/14
to ang...@googlegroups.com
HI guys,

Can someone help me on this ?

Diego Fernandez

unread,
Jun 20, 2014, 5:46:01 AM6/20/14
to ang...@googlegroups.com


--
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 angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

balamurugan r

unread,
Jun 20, 2014, 5:56:48 AM6/20/14
to ang...@googlegroups.com
thanks Diego.. I'm not sure about custom validation directive. anyway i will try to learn... thanks a  lot

Naveen Kohli

unread,
Jun 20, 2014, 10:10:40 AM6/20/14
to ang...@googlegroups.com
Here is example along the lines of what you are looking for. This should provide you some stating point.

balamurugan r

unread,
Jun 20, 2014, 3:23:19 PM6/20/14
to ang...@googlegroups.com
Thanks a lot Naveen.. This is what i was looking after..
Reply all
Reply to author
Forward
0 new messages