Ionic version: (check one with "x")
[ ] 1.x
[x] 2.x
I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
Components that are created by the VirtualScroll, are running outside the Angular zone.
Expected behavior:
The Components should be created in the Angular zone. Otherwise the change detection does not work properly.
Steps to reproduce:
http://plnkr.co/edit/cgtc3d?p=preview
Other information:
This should be wrapped with NgZone#run.
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
[email protected]
Hello, thanks for using Ionic! We will look into this.
At the moment there are a lot of problems with virtual scroll, maybe anyone can suggest alternative?
Are there any plans to fix this or will a PR be accepted? This is a blocker for our apps and forces us to stay on RC.3.
Virtual scroll buvs is also blocker for our app, hope they fix it in 2017 :)
as a workaround --> use the OnPush ChangeDetectionStrategy.
import { ChangeDetectorRef, ChangeDetectionStrategy, Component } from '@angular/core';
// ...
@Component({
templateUrl: 'invoice.list.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class MyPage {
data: Data[];
constructor(
public dataService: DataService,
public changeDetector: ChangeDetectorRef
) {
dataService.get().then(res => {
this.data = res;
this.changeDetector.markForCheck();
}, err => {
console.log(err);
});
}
}
If you update the data/ items of the virtual scroll use
this.changeDetector.detectChanges();
Hacky, and i do not know if this will have sideeffects or if there are collisions if another detection runs.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Most helpful comment
as a workaround --> use the OnPush ChangeDetectionStrategy.
If you update the data/ items of the virtual scroll use
Hacky, and i do not know if this will have sideeffects or if there are collisions if another detection runs.