I using @Inject(DOCUMENT)
to build scrollTop
can be work on PC chrome, but not work in iphone.
for exapmle:
structure:
<app-header></app-header>
<app-body></app-body>
app-header
component:
import { DOCUMENT } from '@angular/common';
import { Component, OnInit, HostListener, Inject } from '@angular/core';
constructor(@Inject(DOCUMENT) private document: Document) { }
@HostListener('window:scroll', [])onWindowScroll() {
console.log(this.document.documentElement.scrollTop);
}
Sliding up and down, the this.document.documentElement.scrollTop
value always 0 in iphone 6S. but work in PC chrome browser.