-
Notifications
You must be signed in to change notification settings - Fork 27.4k
$parsers functions may not run when they should #8077
Comments
And if the idea was not to trigger $parsers chain if value remains the same, then this is also broken, because if we
Result: 'a...a...a' If it was the idea, of cause |
@Alexsey - this is not really what Moreover You can see this working here: http://plnkr.co/edit/vq5c1CgkxmVdynWjj8WG?p=preview What I suspect you really want to do is actually write specific handler code inside your own input directive that handles the blur event and updates the viewValue before it is passed to ngModel at all. |
@petebacondarwin I think we should document that |
@petebacondarwin thanks, in case I need both: $parser and on-blur. For simplicity I just remove part that works right. But your example really help to understand how I should act. @shahata about documentation: in $formatters description says that "Array of functions to execute, as a pipeline, whenever the model value changes" which is not true, because when model assign to and is changing by user $formatters functions are not running. But they do if model changes externally. It would be really nice to have explanation of when that run and when they not in the docs. |
@Alexsey - formatters run when the model changes programmatically. parsers run when the view value is updated (most commonly due to user input) |
so, should issue be open till appropriate changes would be made in docs and/or readability of $modelValue, or separate issues should be created for those and this one closed? |
@Alexsey - could you please close this one and open a new issue about the docs? |
Here is plunker
Result: 'aaa' in input, 'a.a.a' in model
Should be: 'a.a.a' in input and model should not be different from input
As we can see in console, $parsers functions are not running after changing input value to one was entered before, even if it where changed between inputs
The text was updated successfully, but these errors were encountered: