gmh*_*mhk 8 javascript typescript angular
以下是我执行以下 prod 命令时出现的错误
ng 构建 --prod
src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(5,16) 中的错误:长度为“0”的元组类型“[]”在索引“处没有元素” 0'。
src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(5,62):长度为“0”的元组类型“[]”在索引“0”处没有元素。
src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(5,62):长度为“0”的元组类型“[]”在索引“0”处没有元素。
src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(9,16):长度为“0”的元组类型“[]”在索引“1”处没有元素。
src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(9,62):长度为“0”的元组类型“[]”在索引“1”处没有元素。
src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(9,62):长度为“0”的元组类型“[]”在索引“1”处没有元素。
src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(13,16):长度为“0”的元组类型“[]”在索引“2”处没有元素。
src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(13,62):长度为“0”的元组类型“[]”在索引“2”处没有元素。
src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(13,62):长度为“0”的元组类型“[]”在索引“2”处没有元素。
与上述错误相关的源代码如下所示
<div mat-dialog-content>
<div style="margin-top: 30pt" *ngIf="data.quote[0]!=null">
<span><b>{{data.quote[0] | currency}}</b></span> <br />
{{data.lastUpdatedDate[0] | date :'mediumDate'}} | {{data.supplierName[0]}}
</div>
<div style="margin-top: 10pt" *ngIf="data.quote[1]!=null">
<span><b>{{data.quote[1] | currency}}</b></span> <br />
{{data.lastUpdatedDate[1] | date :'mediumDate'}} | {{data.supplierName[1]}}
</div>
<div style="margin-top: 10pt" *ngIf="data.quote[2]!=null">
<span><b>{{data.quote[2] | currency}}</b></span> <br />
{{data.lastUpdatedDate[2] | date :'mediumDate'}} | {{data.supplierName[2]}}
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
Ts 文件如下所示
export interface DialogData {
quote: [];
lastUpdatedDate : [];
supplierName: [];
}
Run Code Online (Sandbox Code Playgroud)
gmh*_*mhk 16
以下 ts 更改帮助我解决了这个问题
长度为“0”的元组类型“[]”在索引“1”处没有元素。
export interface DialogData {
quote: string[];
lastUpdatedDate : string[];
supplierName: string[];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10226 次 |
| 最近记录: |