Skip to content

Commit fd3c6ba

Browse files
committed
fix(virtual-scroll): create views inside zone
fixes #10451
1 parent 27cb360 commit fd3c6ba

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/components/virtual-scroll/virtual-scroll.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -501,15 +501,17 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
501501

502502
adjustRendered(cells, data);
503503

504-
populateNodeData(
505-
data.topCell, data.bottomCell,
506-
data.viewWidth, true,
507-
cells, records, nodes,
508-
this._itmTmp.viewContainer,
509-
this._itmTmp.templateRef,
510-
this._hdrTmp && this._hdrTmp.templateRef,
511-
this._ftrTmp && this._ftrTmp.templateRef, needClean
512-
);
504+
this._zone.run(() => {
505+
populateNodeData(
506+
data.topCell, data.bottomCell,
507+
data.viewWidth, true,
508+
cells, records, nodes,
509+
this._itmTmp.viewContainer,
510+
this._itmTmp.templateRef,
511+
this._hdrTmp && this._hdrTmp.templateRef,
512+
this._ftrTmp && this._ftrTmp.templateRef, needClean,
513+
);
514+
});
513515

514516
if (needClean) {
515517
this._cd.detectChanges();

src/components/virtual-scroll/virtual-util.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,10 @@ export function populateNodeData(startCellIndex: number, endCellIndex: number, v
233233
availableNode.cell = cellIndex;
234234

235235
// apply the cell's data to this node
236-
availableNode.view.context.$implicit = cell.data || records[cell.record];
237-
availableNode.view.context.index = cellIndex;
238-
availableNode.view.context.count = recordsLength;
236+
var context = availableNode.view.context;
237+
context.$implicit = cell.data || records[cell.record];
238+
context.index = cellIndex;
239+
context.count = recordsLength;
239240
availableNode.hasChanges = true;
240241
availableNode.lastTransform = null;
241242
hasChanges = true;

0 commit comments

Comments
 (0)