These are chat archives for angular/material

16th
Jul 2018
Neil Stevens
@StickNitro
Jul 16 2018 12:50
Anyone able to answer a question please?
I want to know if it is possible to pass data to a mat-drawer with a component as its content, I know I could set a variable on the parent component when the user clicks open and have that bound to the mat-drawer component but that seems like a hack so I wondered if there was a better way to do this (similar i guess to how the mat-dialog does it)
venkatakrishna874
@venkatakrishna874
Jul 16 2018 16:20

Hi
can anyone help me to listen scroll event on mat-autocomplete overlay box

Template code

<input matInput placeholder="Notebook Page" formControlName="notebookPage" [matAutocomplete]="NBPageAutocomplete" >
</mat-form-field>
<mat-autocomplete  #NBPageAutocomplete="matAutocomplete" cdkScrollable >
  <mat-option  *ngFor="let option of suggestedNBPageNames" [value]="option">
                {{ option }}
  </mat-option>
</mat-autocomplete>

component code

import { ScrollDispatcher } from '@angular/cdk/overlay';

constructor(public scroll: ScrollDispatcher) {}
ngAfterViewInit() {
    this.scroll.scrolled().subscribe((data: CdkScrollable) => {
       console.log(data);
      //make an HTTP call when it reaches to the end, to add some more data
    });
  }