fix(img): ensure scroll has been initialized

This commit is contained in:
Adam Bradley
2016-12-07 15:59:20 -06:00
parent aec8f51b60
commit 39e1dce72d
4 changed files with 9 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ export class ScrollView {
scrollStart = new Subject<ScrollEvent>();
scroll = new Subject<ScrollEvent>();
scrollEnd = new Subject<ScrollEvent>();
initialized: boolean;
private _el: HTMLElement;
private _js: boolean;
@@ -28,7 +29,9 @@ export class ScrollView {
constructor(private _dom: DomController) {}
init(ele: HTMLElement, contentTop: number, contentBottom: number) {
if (!this._el) {
if (!this.initialized) {
this.initialized = true;
assert(ele, 'scroll-view, element can not be null');
this._el = ele;