question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NG_ASYNC_VALIDATORS on disabled control

See original GitHub issue

I’m submitting a … (check one with “x”)

[x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior NG_ASYNC_VALIDATORS not called if control is disabled

Expected/desired behavior NG_ASYNC_VALIDATORS called even if control is disabled.

  • Angular version: 2.0.0-rc.6
  • Browser: all
  • Language: TypeScript 2.0

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
karacommented, Sep 9, 2016

Disabled controls are exempt from validation by design to match how native HTML5 forms work. So it’s expected that async validators wouldn’t run in that case. The bug here is that sync validators are still running. Though it won’t currently affect the calculation of the status, it’s unnecessary and we shouldn’t be calling them at all. I’m working on a PR to ensure sync validators won’t run on disabled controls either.

2reactions
pkozlowski-opensourcecommented, Sep 2, 2016

Hmm, not sure I see why this should be the case. If a control gets disabled a user can’t change its value so in this case validation of the user input doesn’t make much sense, no?

I’m sure I’m missing sth here so if you could elaborate / provide a plunker it would help clarifying.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Async Validators should not be fired on disabled control #42684
The Async Validation of a FormControl fires when the control is disabled. My understanding, i.e. from #11287 is that this behavior should not...
Read more >
Using Custom Async Validators in Angular Reactive Forms
In Angular, you can do this using Async Validators. ... DISABLED: This control is exempt from validation checks. async validator 3/3.
Read more >
Control with async validator changes its state to pending when ...
This will cancel any currently running async validators, leaving the control in PENDING status. Next, the call to this._runAsyncValidator(opts.
Read more >
Angular: Custom Async Validators - Medium
Angular: Custom Async Validators. Angular has a very robust library for handling ... DISABLED: This control is exempt from validation checks.
Read more >
AbstractControl - Angular
A control is disabled when its status is DISABLED . Disabled controls are exempt from validation checks and are not included in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found