I'm trying to create a custom "range" directive that uses ng-model and only
triggers model updates on blur.
To accomplish this, I combined two input[type=number] directives that use
ng-model to take a min and a max value and format/parse a model that looks
like "1 - 10". Then when I actually use the input I add ng-model-options={
updateOn: 'blur'} to so it should only trigger the update on blur.
The problem is that my model is never being updated, even on blur. It looks
like the ng-change event gets triggered by the input on blur, but the
$setViewValue of the custom directive doesn't send it through the parsers
pipeline.
Here is a plunkr that demonstrates it:
http://plnkr.co/edit/ZMReb5pAi1CBcZRDHJqv?p=preview
What exactly is going on here? The only "solution" i can figure out is to
force a $commitViewValue in my onValueChange function, but that makes it so
it commits it as soon as i blur any of the individual inputs, not the
entire thing. Any ideas?
--
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.