Skip to content

Asynchronous validator overrides validation result from synchronous validator #8923

@NiklasJFischer

Description

@NiklasJFischer
  • I'm submitting a ...
  • [x ] bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

Current behavior
When adding both synchronous and asynchronous validators to a control, the control is in valid state after the asynchrous validator is done even though the synchronous validator says invalid. For example if you have the "required" validator and a custom asynchrouns validator that takes 2 seconds to complete and you erase all text during these 2 seconds the control is in valid state after the 2 seconds.

Expected/desired behavior
The control should be in invalid state because of the "required" validator.

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via
    1. Create a form with an input type="text"
    2. Add a control to that input with the "required" validator and a custom asynchronouns validator that takes 2 seconds to complete.
    3. Write some text in the input control to trigger the asynchrouns validator and then erase all text before it completes
  • What is the expected behavior?
    The control should be in invalid state and not valid state because of the "required" validator
  • What is the motivation / use case for changing the behavior?
    Form validation should work with asynchronous validators
  • Please tell us about your environment:
  • Angular version: 2.0.0-beta.17
  • Browser: [Chrome 50 | IE 11]
  • Language: [TypeScript 1.7.3 | ES5 ]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions