Controlling the position of an angular material panel 2 autofill panels

I am trying to control the position of the autofill options panel for material angular material 2 and put this panel in a separate div from the div of the actual input.

Here is what I tried:

<div fxLayout="row">
  <div fxFlex="50">
    <form [formGroup]="formStatus.form">
      <div>
        <md-input-container>
          <input mdInput formControlName="title" placeholder="Titre">
        </md-input-container>
      </div>
      <div>
        <md-input-container>
          <input mdInput placeholder="Address" [mdAutocomplete]="auto" formControlName="address">
        </md-input-container>
      </div>
    </form>
  </div>
  <div fxFlex="50" style="background-color: palegreen">
    <!-- options panel should appear here in the palegreen div -->
    <md-autocomplete #auto="mdAutocomplete" [displayWith]="addressFormatter">
      <md-option *ngFor="let address of addresses | async" [value]="address">
        {{ address.description }}
      </md-option>
    </md-autocomplete>
  </div>
</div>

However, the options bar is still displayed right below the input, and its position is apparently related to the input position ...

+4
source share
2 answers

, , mat-calendar mat-autocomplete-panel, . , .

:

.mat-autocomplete-panel {
   position: fixed !important;
   top:30% !important;
   left: 40%;
   right: 30%;
   border: 3px solid #73AD21;
   background-color: palegreen !important;
}

Datepicker

0

angular 2

 ::ng-deep .mat-autocomplete-panel{

        } 
0

Source: https://habr.com/ru/post/1679519/


All Articles