Я работаю над проектом Angular-6. Я пытаюсь получить событие Window-Scroll в одном из компонентов с именем SectionComponent.
Стили html и Тег body:
Код: Выделить всё
html, body {
overflow: auto;
position: relative;
margin: 0;
height: 100%;
}
Мой AppComponent:
HTML:
Код: Выделить всё
Код: Выделить всё
#wrapper {
width: 100vw;
height: 100vh;
position: relative;
overflow: auto;
}
Код: Выделить всё
@HostListener('window:scroll', [])
onWindowScroll() {
console.log('scroll');
}
Мой HomeComponent:
HTML:
Код: Выделить всё
Код: Выделить всё
.home-wrapper {
position: relative;
overflow-y: auto;
height: 100%;
}
Код: Выделить всё
@HostListener('window:scroll', [])
onWindowScroll() {
console.log('scroll');
}
HTML:
Код: Выделить всё
Код: Выделить всё
.section-wrapper {
position: relative;
height: 2241px;
}
Код: Выделить всё
@HostListener('window:scroll', [])
onWindowScroll() {
console.log('scroll');
}
Подробнее здесь: https://stackoverflow.com/questions/524 ... -angular-6