Show json fields on screen

Asked

Viewed 22 times

0

I get following Json:

inserir a descrição da imagem aqui

I would like to show on screen the following fields in a table:

standings>0>table>All returns from 0 to n

What I have so far is:

<div *ngFor="let tabelas of campeonato.standings | keyvalue">
<div >
    <table class="table table-striped">
        <thead class="thead-dark">
            <tr>
                <th>#</th>
            </tr>
        </thead>
        <tbody ng-if="tabelas.value.type == TOTAL ">
            <tr>
                <td>{{tabelas.value.type}}</td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="7" class="text-center">
                    <h4>Nenhum Campeonato Encontrado.</h4>
                </td>
            </tr>
        </tfoot>
    </table>
</div>

But I’m not getting to the fields of table

  • The problem is in ngFor, try like this: *ngFor="let tabelas of campeonato.standings[0].table | keyvalue"

  • I got the following mistake ERROR TypeError: Cannot read property '0' of undefined

  • because you’re using the keyvalue pipe?

  • I was trying to use the key to be able to do an if by standings[0]

  • Try *ngFor="Let tables of championship.standings[0]. table" without the keyvalue. And puts a championship ngIf in a div above that ngFOr to make sure the backend response has arrived.

  • @Eduardovargas remains the same problem, ERROR TypeError: Cannot read property '0' of undefined, he is doing the foreach correctly, but this error continues

  • it is pq it is Undefined until the answer of the back, to solve or vc start it empty somehow or make a ngif around it

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.