Comments (3)
Hi @Dejavu333 ,
I don't understand the motivations of the following points, maybe could explain it a little more :
1.Formcontrol should know whether it is focused, submitted.
The focused property can easily find a utility, but for the submit, what use cases have you in mind (for the FormControl
particulary, as for the FormGroup
it can find a useful usage) ?
Anyway the [formGroup]
directive has an property that track the submit status :
<form [formGroup]="form" (ngSubmit)="submit()" #formDir=ngForm>
<input type="text" formControlName="test" />
<button type="submit">submit</button>
</form>
<span>{{formDir.submitted}}</span>
What have you in mind for the focus
event ?
2.We should be able to add multiple updateOn values not just one.
Does it make any sense to have a stream for the focus event anymore ? What are you planning to listen for the focus event ? I think that the events streamed for the update should be bounded to avoid any overload during the listening of events.
The third point makes sense.
from angular.
1 and 2 kinda goes hand in hand.
Currently, FormControl validations are tightly coupled and can only be triggered by a single event, which limits flexibility. For instance, you might want to trigger different validators for FormGroup and FormControl, but the current setup doesn’t allow for this differentiation, since the updateValueAndValidity function triggers valueChanges in the parent FormGroup, which in turn activates its validators. This becomes an issue when you want your controls' validators to be triggered by different events - for example, one on ‘blur’ and ‘hover’ (this is where multiple values would come into play), another on ‘change’, and the FormGroup validators on ‘submit’ and ‘submit’ only.
It would be beneficial to decouple these elements to allow for more granular control over when and how validations are triggered.
from angular.
I've started to implement a new approach, where you can instantiate a formControl like this:
Cleaner and can achieve the desired behaviour I stated above.
from angular.
Related Issues (20)
- Lack of spacing in template-driven-forms #show-and-hide-validation-error-messages HOT 2
- Angular.dev docs Expand doesn't work HOT 2
- ROUTES provider in a standalone lazy-loaded component not providing routes HOT 3
- Angular Dev: Improvement UI snippet "docs-code" HOT 1
- FormTruple - variant o FormArray that can create controls on elements based on data HOT 1
- NG0911: View has already been destroyed. HOT 8
- Add a new "ChangeDetectionStrategy.DeepProxy" change detection strategy. HOT 4
- Security Vulnerability in @angular-devkit/build-angular@16 Due to Outdated Vite Dependency HOT 2
- Control flow migration hanging on formatting in rare cases
- "Angular Devtools only supports Angular versions 12 or above" on new Angular 17 SSR application HOT 3
- Docs: CLI command detail pages dont exist HOT 2
- Docs: Improve Syntax Highlighting HOT 4
- Docs: angular.dev/guide/testing missing image HOT 2
- Code example not displayed on Testing sections HOT 1
- Dynamic require is not supported HOT 3
- Cant Install angular libary into angular app for local development HOT 4
- viewTransition not working with eventCoalescing HOT 3
- No docs about how to test effects in component constructor HOT 7
- Pending APP_INITIALIZER doesn't trigger Hydration warning after APPLICATION_IS_STABLE_TIMEOUT HOT 3
- Creating a view inside an `effect` will track any signal reads that happen in the view HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular.