带有matAutocomplete的Angular 5 matDatepicker

时间:2018-04-22 15:09:36

标签: angular forms angular-material

很抱歉,他们知道输入matDatepicker和matAutocomplete

中是否有输入
<mat-form-field>
    <input [matDatepicker]="dp3" [matAutocomplete]="lote" matInput formControlName="Id_Lote" placeholder="Fecha vencimiento" class="form-control" id="Id_Lote" required>
    <mat-datepicker-toggle matSuffix [for]="dp3"></mat-datepicker-toggle>
    <mat-datepicker #dp3 disabled="false"></mat-datepicker>
    <mat-autocomplete #lote="matAutocomplete" [displayWith]="displayLote">
      <mat-option  *ngFor="let option of filteredLotes | async" [value]="option">
        {{ option.ExpirationDateProduct }}
      </mat-option>
    </mat-autocomplete>
  </mat-form-field>

当我把两者放在一起时,我得到了这个错误

DetailproductcreateComponent.html:59 ERROR Error: More than one custom value accessor matches form control with unspecified name attribute
at _throwError (forms.js:2432)
at eval (forms.js:2514)
at Array.forEach (<anonymous>)
at selectValueAccessor (forms.js:2503)
at new FormControlName (forms.js:7199)
at createClass (core.js:12449)
at createDirectiveInstance (core.js:12284)
at createViewNodes (core.js:13742)
at callViewAction (core.js:14176)
at execComponentViewsAction (core.js:14085)

0 个答案:

没有答案