【发布时间】:2018-10-10 11:46:46
【问题描述】:
我有带有自动完成字段的模态。 我将 Angular 5 与 Angular 材料 2 一起使用。 modal 加载时,第一个字段的面板始终处于打开状态...
如何避免这种情况?
我尝试在另一个字段上使用 autofocus 属性,但它不起作用...
<form name="indexation">
<br>
<div class="row">
<div class="col-md-12">
<mat-form-field class="index-full-width">
<input
matInput
type="text"
[(ngModel)]="patientChoice"
placeholder="Patient"
aria-label="Patient"
[matAutocomplete]="autoPatient"
[formControl]="myControl">
<mat-autocomplete (optionSelected)="selectPat()" #autoPatient="matAutocomplete" [displayWith]="displayFnPat">
<mat-option *ngFor="let patient of filteredPatients | async" [value]="patient">
<span>{{ patient.lastName }}</span>
<small>{{patient.firstName}}</small> |
<span>né(e) le {{ patient.dateNaissance }}</span> |
<small>IPP: {{patient.ipp}}</small>
</mat-option>
</mat-autocomplete>
</mat-form-field>
</div>
</div>
<br>
这个问题是不是来自材料?
【问题讨论】:
标签: angular autocomplete focus angular-material