mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
@ -6,13 +6,18 @@ import {ionicBootstrap} from '../../../../../src';
|
||||
templateUrl: 'main.html'
|
||||
})
|
||||
class E2EPage {
|
||||
items = [];
|
||||
items: any[] = [];
|
||||
|
||||
@ViewChild('content') content: ElementRef;
|
||||
|
||||
constructor() {
|
||||
for (var i = 0; i < 200; i++) {
|
||||
this.items.push(i);
|
||||
this.items.push({
|
||||
value: i,
|
||||
someMethod: function() {
|
||||
return `!!`
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
</ion-item-divider>
|
||||
|
||||
<ion-item *virtualItem="let item">
|
||||
Item: {{item}}
|
||||
Item: {{item.value}} {{item.someMethod()}}
|
||||
</ion-item>
|
||||
|
||||
</ion-list>
|
||||
|
@ -436,7 +436,7 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
|
||||
this._ftrTmp && this._ftrTmp.templateRef, true);
|
||||
|
||||
// ******** DOM WRITE ****************
|
||||
this._cd.detectChanges();
|
||||
this.detectChanges();
|
||||
|
||||
// wait a frame before trying to read and calculate the dimensions
|
||||
nativeRaf(this.postRenderVirtual.bind(this));
|
||||
@ -470,6 +470,20 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
detectChanges() {
|
||||
let node: VirtualNode;
|
||||
for (var i = 0; i < this._nodes.length; i++) {
|
||||
node = this._nodes[i];
|
||||
if (node.hasChanges) {
|
||||
node.view['detectChanges']();
|
||||
node.hasChanges = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@ -481,14 +495,7 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
|
||||
|
||||
if (this._queue === QUEUE_CHANGE_DETECTION) {
|
||||
// ******** DOM WRITE ****************
|
||||
let node: VirtualNode;
|
||||
for (var i = 0; i < this._nodes.length; i++) {
|
||||
node = this._nodes[i];
|
||||
if (node.hasChanges) {
|
||||
node.view['detectChanges']();
|
||||
node.hasChanges = false;
|
||||
}
|
||||
}
|
||||
this.detectChanges();
|
||||
|
||||
if (this._eventAssist) {
|
||||
// queue updating node positions in the next frame
|
||||
@ -573,7 +580,7 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
|
||||
adjustRendered(this._cells, this._data);
|
||||
|
||||
// ******** DOM WRITE ****************
|
||||
this._cd.detectChanges();
|
||||
this.detectChanges();
|
||||
|
||||
// ******** DOM WRITE ****************
|
||||
this.setVirtualHeight(
|
||||
|
Reference in New Issue
Block a user