0

作为*ngFor循环的一部分,我想提供一个独特的idor name,但得到一个错误:You provided 'undefined' where a stream was expected

这是我的 HTML 代码。

    <mat-form-field appearance="fill" class="notValid">
                    <mat-label>{{selectedLanguage.trLeidaYeled}}</mat-label>
                   <input matInput 
                     [matDatepicker]="trLeidaYeled" 
                     id="trLeidaYeled{{i}}" 
                     [(ngModel)]="child.trLeida" 
                     name="trLeidaYeled{{i}}"
                     />
                   <mat-datepicker-toggle matSuffix for="trLeidaYeled{{i}}"></mat-datepicker-toggle>
                   <mat-datepicker #trLeidaYeled ></mat-datepicker>
    </mat-form-field>

我也尝试了以下但得到同样的错误。

 <mat-form-field appearance="fill" class="notValid">
                    <mat-label>{{selectedLanguage.trLeidaYeled}}</mat-label>
                   <input matInput 
                     [matDatepicker]="trLeidaYeled" 
                     [id]="'trLeidaYeled'+i" 
                     [(ngModel)]="child.trLeida" 
                     [name]="'trLeidaYeled'+i"
                     />
                   <mat-datepicker-toggle matSuffix [for]="'trLeidaYeled'+i"></mat-datepicker-toggle>
                   <mat-datepicker #trLeidaYeled ></mat-datepicker>
                 </mat-form-field>

4

0 回答 0