Never mind, I got around it by requiring ngModel and working off that. Thanks again! :)
On Sunday, January 12, 2014 6:38:02 AM UTC+1, Matt Bailey wrote: > > Hey there, > > Here's an example of how you might go about validating a couple fields > together: http://jsfiddle.net/DFBWK/1/ > > Basically, you run the validateDate function every time any of the fields > change and the "birthdate" validation key gets set. This triggers the > entire form being valid or invalid. You can probably take it from here to > do whatever you need with it. You can probably set this up several > different ways, but this is just one way that works. > > -Matt > > On Friday, January 10, 2014 6:53:20 AM UTC-8, [email protected] wrote: >> >> Hi, >> >> I am trying to write a custom validator to validate a birthdate which the >> user enters using three input fields, e.g. >> >> <input type="text" name="day" ng-model="person.day" /> >> <input type="text" name="month" ng-model="person.month" /> >> <input type="text" name="year" ng-model="person.year" /> >> >> Together, they have to make up for a valid date object, otherwise they >> should invalidate the form and display a warning to the user. >> >> How should I go about this using directives? I'm comfortable validating a >> single field, but I am unsure how to combine dependent fields such as >> these. As I will be using this more often, I'd like to prevent building a >> function directly in the controller. I can't wrap my head around the >> documentation regarding this. Any help will be appreciated. Thanks! >> > -- 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/groups/opt_out.
