From b16228b372b683f570476175ef8af8917bc010da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=A4slin?= Date: Thu, 13 Oct 2016 17:04:19 +0200 Subject: [PATCH] fix(virtual-scroll): set this.approxItemHeight before update(true) is called first (#8350) --- src/components/virtual-scroll/virtual-scroll.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/virtual-scroll/virtual-scroll.ts b/src/components/virtual-scroll/virtual-scroll.ts index 9248c3dde8..034f228bb7 100644 --- a/src/components/virtual-scroll/virtual-scroll.ts +++ b/src/components/virtual-scroll/virtual-scroll.ts @@ -343,6 +343,11 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy { this._init = true; + if (!this.approxItemHeight) { + this.approxItemHeight = '40px'; + console.warn('Virtual Scroll: Please provide an "approxItemHeight" input to ensure proper virtual scroll rendering'); + } + this.update(true); this._platform.onResize(() => { @@ -350,10 +355,6 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy { this.update(false); }); - if (!this.approxItemHeight) { - this.approxItemHeight = '40px'; - console.warn('Virtual Scroll: Please provide an "approxItemHeight" input to ensure proper virtual scroll rendering'); - } } }