Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 如何对齐输入字段右侧的材质图标?_Angular_User Interface_Angular Material - Fatal编程技术网

Angular 如何对齐输入字段右侧的材质图标?

Angular 如何对齐输入字段右侧的材质图标?,angular,user-interface,angular-material,Angular,User Interface,Angular Material,我正在使用mat自动完成文本框。我有一个搜索图标,目前它是左对齐的输入。我想把它对准右边。谁能帮我一下吗 <mat-form-field floatLabel="never" class="example-full-width" appearance="outline"> <input type="search" placeholder="Name" aria-label="Number" matInput [formControl]="myCont

我正在使用mat自动完成文本框。我有一个搜索图标,目前它是左对齐的输入。我想把它对准右边。谁能帮我一下吗

<mat-form-field floatLabel="never" class="example-full-width" appearance="outline">
      <input type="search" placeholder="Name"
        aria-label="Number" matInput [formControl]="myControl" [matAutocomplete]="auto" />
      <mat-icon color="primary" matPrefix>search</mat-icon>
      <mat-autocomplete #auto="matAutocomplete">
        <mat-option *ngFor="let option of filteredOptions | async" [value]="option">
          {{option}}
        </mat-option>
      </mat-autocomplete>
    </mat-form-field>   

只需用matSuffix替换matPrefix

<mat-icon color="primary" matSuffix>search</mat-icon>