简单地说,我下面有一些数据,我想用HTML显示它。
MET:[
{
LABEL:"WILHELMSEN HLD ASA",
ISINCODE:"NO0010571698",
RECORD_DATE:"2022-09-16",
EVENT_DATE:"2022-09-30",
EVENT_TYPE:"AG Ordinaire",
SOLDE:15000.00,
NUMERO_AG:10642,
CREAT_DATE:"2022-04-01",
MOD_DATE:"2022-04-01",
EMETTEUR:"408659",
DEPOSITAIRE:"CA000005775300",
ISCONFIRMED:1,
ISSRD2ELIGIBLE:1,
ADRESSE1:"Strandveien 20",
ADRESSE2:"",
LOCALITE:"LYSAKER",
CODEPOSTAL:0,
PAYS:"NOR",
STATUTAG:9,
URL:"",
RESOLUTION:[
{
REF:"01",
},
]
}
],
我设法显示了MET
表中的数据。
迈斯我有一个问题,用表RESOLUTION
.在页面服务中.
src/app/todo/todo.service.ts:31:20 - error TS1312: Did you mean to use a ':'? An '=' can
only follow a property name when the containing object literal is part of a destructuring pattern.
31 RESOLUTION = [
我不知道是什么问题?
待办事项服务
export class TodoService {
MET = [
{
LABEL: "WILHELMSEN",
ISINCODE: "NO0010571698",
RECORD_DATE: "2022-09-16",
EVENT_DATE: "2022-09-30",
EVENT_TYPE: "AG Ordinaire",
SOLDE: 15000.0,
NUMERO_AG: 10642,
CREAT_DATE: "2022-04-01",
MOD_DATE: "2022-04-01",
EMETTEUR: "408659",
DEPOSITAIRE: "CA000005775300",
ISCONFIRMED: 1,
ISSRD2ELIGIBLE: 1,
ADRESSE1: "Strand 20",
ADRESSE2: "",
LOCALITE: "LYS",
CODEPOSTAL: 0,
PAYS: "NOR",
STATUTAG: 9,
URL: "",
RESOLUTION = [
{
REF: "01",
},
],
},
];
constructor() {}
}
待办组件
export class TodoComponent implements OnInit {
MET: any;
constructor(private todoService: TodoService) {}
ngOnInit() {
this.MET = this.todoService.MET;
}
}
todo.html
<div class="container text-center" *ngIf="MET">
<h2 class="pt-3 pb-3">HTML Table</h2>
<table class="mb-5">
<tr>
<th>Isin</th>
<th>Dénomination</th>
<th>Date de création</th>
<th>Date de modification</th>
<th>Code d'identification</th>
<th>Status</th>
<th>Réference du dépositaire</th>
<th>Confirmé</th>
<th>Eligible à SRD2</th>
<th>Lieu de l'événement</th>
</tr>
<tr *ngFor="let line of MET">
<td>{{ line.ISINCODE }} </td>
<td>{{ line.LABEL }} </td>
<td>{{ line.CREAT_DATE }} </td>
<td>{{ line.MOD_DATE }} </td>
<td>{{ line.EMETTEUR}} </td>
<td>{{ line.STATUTAG }} </td>
<td>{{ line.DEPOSITAIRE }} </td>
<td>{{ line.ISCONFIRMED }} </td>
<td>{{ line.ISSRD2ELIGIBLE }} </td>
<td>{{ line.ADRESSE1 }} {{ line.LOCALITE}} </td>
</tr>
</table>
</div>
1条答案
按热度按时间voj3qocg1#
用途
代替
因为你不能在JSON中赋值