Skip to content

Updated event

Murhaf Sousli edited this page Jul 27, 2021 · 3 revisions

The NgScrollbar component has an output (updated) which emits when:

  • After its view is initialised
  • Any of its inputs change
  • Resize sensor emitted (e.g. the content size is changed)

Example: Fire an event when the vertical scrollbar becomes scrollable (vertical scrollbar becomes visible)

<ng-scrollbar #scrollbar="ngScrollbar" (updated)="onScrollbarUpdate(scrollbar.state)"></ng-scrollbar>
onScrollbarUpdated(state: NgScrollbarState) {
  if (state.isVerticallyScrollable) {
    console.log('Scrollable');
  } else {
    console.log('Not Scrollable');
  }
}

Here is a demo stacbklitz

Clone this wiki locally