Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$validators should reset model to undefined upon invalid initial value #10286

Open
@tdakhla

Description

@tdakhla

Simple plnkr in which I'd expect the model value to reset to undefined on load. If I add a 3 and backspace it, the model value is reset to undefined as expected, but that should be the behavior on load as well (things should be consistent):
http://plnkr.co/edit/KcDeisrc1FJAyf4FP5t3?p=preview

It appears that this has been an issue since at least 1.3.0 final (not sure about the beta/rcs). We're in the process of upgrading all of our existing 1.2 directives (which have been resetting model to undefined inside a shared $parsers and $formatters fn), and now that we've moved logic into $validators, our $formatters don't really validate anymore. When an invalid model value comes in, it seems like I need to re-run $validators logic inside $formatters and ensure it returns the correct value, but that seems like a hack more than anything. @Narretz Is there an official workaround for this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions