Control Validators should be observable chains
- 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
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