Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

To be simple, I have some data below and I want to display it in the 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",
     },
    ]
 }
],

I managed to display the data from the MET table.

Mais j’ai un problème avec la table RESOLUTION. dans la page service.ts

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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 = [

I don’t know what the problem is?

todo.service

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() {}
}

todo.component

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>

>Solution :

Use

     RESOLUTION: [
        {
          REF: "01",
        },
      ],

instead of

     RESOLUTION = [
        {
          REF: "01",
        },
      ],

because you can’t assign stuff in a json

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading