Skip to content
Advertisement

how to make a loop on a json file?

I have to handle a JSON file.

In JSON BLOCAGES -> BLOCAGE > I have to retrieve QTE and DTE.

Here is my file JSON here

My problem is that, I display QTE and DTE one time.

For now, I have this => enter image description here

I want to get this result => enter image description here

I’m missing the array elements [1] and [2], how could I add them from a loop?

Here is my method prepareDataForBlocage()

JavaScript

My HTML

JavaScript

Advertisement

Answer

I see 2 problems in your code

the first:

JavaScript

the second is that you do not loop over an array in your template.

You could try something like:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement