Home > database >  Can't bind to 'isOpen' since it isn't a known property of 'mat-autocomplete
Can't bind to 'isOpen' since it isn't a known property of 'mat-autocomplete

Time:05-04

First example from the 13.3.5. Autocomplete docs:

<form >
  <mat-form-field  appearance="fill">
    <mat-label>Number</mat-label>
    <input
      type="text"
      placeholder="Pick one"
      aria-label="Number"
      matInput
      [formControl]="myControl"
      [matAutocomplete]="auto"
    />
    <mat-autocomplete
      autoActiveFirstOption
      #auto="matAutocomplete"
      [isOpen]="true"
    >
      <mat-option
        *ngFor="let option of filteredOptions | async"
        [value]="option"
      >
        {{option}}
      </mat-option>
    </mat-autocomplete>
  </mat-form-field>
</form>

The API documentation states that I can pass isOpen to <mat-autocomplete> to control whether the autocomplete panel is open. If passed simply as isOpen="true" it does nothing, if passed as [isOpen]="true" it reports the above error. Am I not able to pass properties mentioned in the docs? Or am I doing something wrong?

CodePudding user response:

It's not something you pass in, that's a flag for if it's opened or not that you can use if you need it. It's not part of the @Input() section.

  • Related