-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Feature request: Ability to read trigger event for $parsers. #8976
Comments
Hm, ideally the $parsers should only be concerned with transforming the $viewValue into the $modelValue. What you describes sounds like you are 'abusing' it for something else. Can you describe your setup a little? |
Okay, let's say I have a number directive that does the following; Checks if the viewValue is a valid number. In my parser then, I would like to do rounding and decimal placing on 'blur' but I would like the validation to keep happening while typing. I can do |
That's pretty interesting. Do the parsers do all that, parsing, validation, modifying the viewValue? And do you use angular 1.3 or 1.2? |
I'm using angular 1.3-beta.rc0 My parsers do: And my validators do: |
I was going to suggest that you use |
I'm with @Narretz and think that you are trying to do too much in your parser. I suggest that you create an directive that will listen on blur and do the extra processing when the event fires. |
Currently when an input directive fires a view value change it calls
$setViewValue
. This method has a second parameter trigger that could be optionally passed to the$parsers
pipeline. This could be really useful when you use autocomplete features inside a $parser on blur but you want the model to validate on keyup, etc.ngModelOptions: {updateOn: 'default blur'}
that allows us to trigger the parsers and validators in two different scenarios.$setViewValue
.$parsers
pipeline.What do you guys think?
The text was updated successfully, but these errors were encountered: