Lazy loading causes ExpressionChangedAfterItHasBeenCheckedError (NG-ZORRO?)
See original GitHub issueEven with this workaround, it seems that lazy loading a component doesn’t work. At least that happens when using the NG-ZORRO Tab’s lazy loading mechanism.
this.subscription = this.formGroup.valueChanges
.pipe(
// this is required otherwise an `ExpressionChangedAfterItHasBeenCheckedError` will happen
// this is due to the fact that parent component will define a given state for the form that might
// be changed once the children are being initialized
delay(0),
ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: ‘ng-pristine: true’. Current value: ‘ng-pristine: false’.
Usage example:
<div [formGroup]="formGroup">
<input [formControlName]="formControlNames.name">
<div [formArrayName]="formControlNames.families">
<nz-tabset nzTabPosition="top" nzSize="small" nzType="card">
<nz-tab *ngFor="let c of families.controls; index as i" [nzTitle]="c.value.name">
<ng-template nz-tab> <!-- This -->
<app-family [formControlName]="i"></app-family>
</ng-template>
</nz-tab>
</nz-tabset>
</div>
</div>
I’m trying to understand, but with no luck 'til now.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
ng-zorro cascader lazy load data, nzLoadData function got ...
The reason is that: When you pass loadCityBuildingData to nzLoadData , loadCityBuildData becomes a property of NzCascaderComponent .
Read more >Tabs - NG-ZORRO - Angular UI component library
By default, the contents in nz-tab are eagerly loaded. Tab contents can be lazy loaded by declaring the body in a ng-template with...
Read more >Table | NG-ZORRO - Ant Design
import { NzTableModule } from 'ng-zorro-antd/table'; ... [nzLoadingDelay], Specifies a delay in milliseconds for loading state (prevents flush), number, 0.
Read more >Tabs | NG-ZORRO - Ant Design
import { NzTabsModule } from 'ng-zorro-antd/tabs'; ... Tab contents can be lazy loaded by declaring the body in a ng-template with the [nz-tab]...
Read more >CHANGELOG.md · Gitee 极速下载/ng-zorro - Gitee.com
NG -ZORRO 是 Ant Design 的 Angular 4.0 实现,开发和服务于企业级后台产品. ... message: fix lazy load problem (#3797) (679fdea), closes #3794 ...
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
@maxime1992 I wonder if this might actually be related to the thing I was talking about regarding not destroying the form item controls when the external value updates? Something to check perhaps.
@maxime1992 I’ve created a new repository here https://github.com/lppedd/ngx-sub-form-test Just clone and
npm install
. It is built on this repository, I just modified the provided example and added yourFormArray
fix.Hope Ivy will make debugging Angular Core easier too! Switching from debugging Java code to Javascript code has been a major struggle for me.