NgForm renders form controls slower than expected
See original GitHub issueπ bug report
Affected Package
The issue is caused by package @angular/formsIs this a regression?
No
Description
Unable to access controls object of NgForm when Angular starts rendering component
π¬ Minimal Reproduction
If you access the controls object of NgForm like this:
When Angular starts rendering my component, it said that thereβs no such properties like i have in my form controls:
I console.log() the controls of NgForm, at first, it has nothing like you guys see an empty object in my console, but then chrome developer tool tells βValue below was evaluated just nowβ. Does that mean when Angular starts rendering my component and access the form controls, the form controls havenβt been there yet?
π₯ Exception or Error
π Your Environment
Angular Version:
Angular CLI: 10.0.6
Node: 12.16.3
OS: win32 x64
Angular: 10.0.9
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.1000.6
@angular-devkit/build-angular 0.1000.6
@angular-devkit/build-optimizer 0.1000.6
@angular-devkit/build-webpack 0.1000.6
@angular-devkit/core 10.0.6
@angular-devkit/schematics 10.0.6
@angular/cli 10.0.6
@ngtools/webpack 10.0.6
@schematics/angular 10.0.6
@schematics/update 0.1000.6
rxjs 6.5.5
typescript 3.9.7
webpack 4.43.0
Anything else relevant?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Why is Angular Form very slow within MatDialog component?
I've tried refactoring the form to use for the inputs to use a "Material form" but still has the same slowdown performance. Here's...
Read more >Introduction to forms in Angular
Reactive forms and template-driven forms have different levels of reliance on rendering the UI to perform assertions based on form control and form...
Read more >Testing complex forms - Testing Angular
How to test the logic and accessibility of Angular Reactive Forms.
Read more >Angular Reactive Forms: Tips and Tricks | by Netanel Basal
There might be cases when we don't want to invalidate the form just because a single control is invalid. I haven't come across...
Read more >Angular Template Driven vs. Reactive Forms | Syncfusion Blogs
As the form keeps growing, the view templates get cluttered, making the code difficult to read. Thus, it gets harder to maintain, resulting...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As far as I understand it, hereβs what happens, chronologically:
f.controls
doesnβt contain the child controls yet.ngOnChanges
method of the child ngModel directives would be called, and thatβs what would register the child controls into their parent NgForm directive.Hi @anphamv, thanks for reporting this issue. However, you didnβt provide sufficient information for us to understand and reproduce the problem. Please check out our submission guidelines to understand why we canβt act on issues that are lacking important information. Could you please provide a repro using Stackblitz so that we can have a look? Thank you.