MatAutoComplete无法读取未定义的值

时间:2018-06-19 17:49:21

标签: angular angular-material

我将具有@Input指令具有数组的对象传递给具有多个matAutoCompletes的子组件,但是我无法读取undefined的属性值,不确定原因。

父亲组件html

<div *ngIf="modalActive">
        <div class="modal-body">
            <app-resumo-cliente [dadosResumo]="dadosResumo" [modeloItensContratados]="resgate" (myEvent)="openModal($event)"></app-resumo-cliente>
        </div>
        <div class="botoes-modal">
        </div>
        <div class="clear"></div>
        </div>

html

 <mat-form-field>
          <input type="text" placeholder="Cep" aria-label="Number" matInput formControlName="cep" [matAutocomplete]="auto">
          <mat-autocomplete #auto="matAutocomplete">
            <mat-option *ngFor="let cep of dadosResumo.ceps" [value]="cep">
              {{ cep }}
            </mat-option>
          </mat-autocomplete>
        </mat-form-field>

dadosResumo对象

{enderecos: Array(1), telefones: Array(1), emails: Array(1), contasCompletas: Array(1), contas: Array(1), …}
agencias
:
[undefined]
bancos
:
["1"]
ceps
:
["20550140"]
contas
:
[Array(1)]
contasCompletas
:
["27278-727278-7"]
emails
:
[Array(1)]
emailsAuto
:
[undefined]
enderecos
:
[{…}]
logradouros
:
["RUA VISCONDE DE ITAMARATI, 74 BL 2 / 402"]
telefones
:
[Array(1)]
telefonesAuto
:
["22041027"]

有什么想法吗?

0 个答案:

没有答案