angular / angular/angular

Control Validators should be observable chains

Open
#9,119 8 comments 62 reactions 0 assignees View on GitHub
area: forms feature feature: under consideration state: Needs Design
Dominant language
TypeScript
Stars
101k
Forks
27.5k
Avg merge
1d 19h
Merged PRs (30d)
288

Description

- **I'm submitting a ...**
- [X] feature request

**Current behavior**
Validators are callback functions

**Expected/desired behavior**
Validators should be observables.
- **What is the motivation / use case for changing the behavior?**

Currently it is very counter intuitive to build debounced async validators (http://plnkr.co/edit/2NuNj1lBj2e6OdUJjFra?p=preview). It would be much cleaner to work with an observable chain that is subscribed once, instead of subscribed for every value change of a control.

It could look like this:

```
new Control('',validator$=>{
return validator$.map(valid=>{
valid.errors.minLen=valid.value.length>5?null,"Length must be at least 5";
return valid;
});
});
```

Contributor guide

Open the contributing guide

Research direction

No file, test, or entry point is named. Start by locating Control and its validator implementation, then trace how validators are invoked for control value changes. Done means the design supports observable validator chains, including debounced asynchronous validation, with the behavior demonstrated by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.