how to access the angular internal validation function

70 views
Skip to first unread message

jason zhang

unread,
Feb 17, 2014, 3:04:48 AM2/17/14
to ang...@googlegroups.com
Hi,all
I am trying to implement a new validation function for input. My validation will be like ng-list plus  type="number". The fields allows for multiple number.  I'd like to use the validation logic already inside angularjs for numberInputType. But how can I access those functions?

thanks

-jason

Sander Elias

unread,
Feb 18, 2014, 1:49:45 AM2/18/14
to ang...@googlegroups.com
Hi Jason,

There is no validation for input type number, that I'm aware of. Can you elaborate on what it is you want to accomplish? Perhaps even a plunk or fiddle?

Regards
Sander

jason zhang

unread,
Feb 18, 2014, 11:51:23 AM2/18/14
to ang...@googlegroups.com
Hi, Sander
I want to have a text field for a list of integer separated by ",".  Each integer has follows certain restriction such as min and max value. This is basically ngList plus the number validation for each integer.  Right ngList only works for single text, and number validation only work for a single number input.

Does it make sense?
regards
-jason


--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/qBuD2OPVBjY/unsubscribe.
To unsubscribe from this group and all its topics, 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/groups/opt_out.



--
-jiesheng

Sander Elias

unread,
Feb 18, 2014, 12:04:46 PM2/18/14
to ang...@googlegroups.com
Hi Jason,

Yes, that does make sense. I think it's much simpler to add a new validation for that, then it is to augment the existing ones to what you want!
you can utilise the ngList directive, and then traverse the array to check min/max and set the error accordingly.
have a look at http://docs.angularjs.org/guide/forms and the part that says "custom validation"

Regards
Sander

Pulkit Singhal

unread,
Sep 3, 2014, 10:53:17 AM9/3/14
to ang...@googlegroups.com
Hi Jason,

Can you share a plunker if you implemented a validator to iterate+validate each value from ngList?

Thanks!
- Pulkit

jason zhang

unread,
Sep 3, 2014, 12:21:57 PM9/3/14
to ang...@googlegroups.com
Hi, Pulkit
I did not use ngList. Instea, I wrote a custom validator for input: https://github.com/jasonzhang2022/flexims/blob/master/js/app/jsfragments/editor/prop_validator.js


--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/qBuD2OPVBjY/unsubscribe.
To unsubscribe from this group and all its topics, 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.



--
-jiesheng
Reply all
Reply to author
Forward
0 new messages