$setValidity not updating $valid flag in real-time

196 views
Skip to first unread message

Jason

unread,
Sep 30, 2013, 10:20:50 PM9/30/13
to ang...@googlegroups.com
Hi all - 

I have a custom form input validator implemented using a directive.  In the directive, the validation event is bound to the input's blur event. So on blur, I set the validity of the model using $setValidity.  However, the $valid state is not updated until I give the input focus again and modify its value.  In other words, the $valid state always lags one state behind.

Any idea how to get reflect the status of $valid in real-time?

Thanks in advance,

Jason

Carlos Eduardo Bier

unread,
Sep 30, 2013, 10:59:59 PM9/30/13
to ang...@googlegroups.com
Hello!

Can you paste your code? I hope that help you.. :)

Jason

unread,
Sep 30, 2013, 11:19:31 PM9/30/13
to ang...@googlegroups.com
Hi there,

I'm using the Angular Stripe helper library made available by backlift.com.  Here's the code block I'm referring to: https://github.com/laurihy/angular-payments/blob/master/lib/angular-payments.js#L613

Thanks,

Jason

Carlos Eduardo Bier

unread,
Sep 30, 2013, 11:33:14 PM9/30/13
to ang...@googlegroups.com
When you debug code, the _Validate function are returning true?

Jason

unread,
Oct 1, 2013, 12:03:50 AM10/1/13
to ang...@googlegroups.com
Yes it does.  The _validate function works as expected.

Jason
Reply all
Reply to author
Forward
0 new messages