1
resposta

Tabela não é renderizada

class NegociacoesView {

private _elemento: Element;

constructor(seletor: string) {

    this._elemento = document.querySelector(seletor);
}

update(model: Negociacoes): void {
    this._elemento.innerHTML = this.template(model);
}

template(model: Negociacoes): string {

    return `
    <table class="table table-hover table-bordered">
        <thead>
            <tr>
                <th>DATA</th>
                <th>QUANTIDADE</th>
                <th>VALOR</th>
                <th>VOLUME</th>
            </tr>
        </thead>

        <tbody>
            ${model.paraArray().map(negociacao => {
                return `
                <tr>
                    <td>${negociacao.data.getDate()}/${negociacao.data.getMonth() +1}/${negociacao.data.getFullYear()}}</td>
                    <td>${negociacao.quantidade}</td>
                    <td>${negociacao.valor}</td>
                    <td>${negociacao.volume}</td>
                </tr>`
            }).join()}
        </tbody>

        <tfoot>
        </tfoot>
    </table>               
    `;
}

}

1 resposta

Fala ai Lécio, tudo bem? Está dando algum erro no console do navegador?

Fico no aguardo.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software