Wednesday, October 18, 2017

bind a table from an object in angular

i need to bind a table from an object in angular. when i submit my form i get the object and i send from component 1 to component 2, but when i create another object in my table only i see the last insert. HEre´s my code

component n°2


     import { Component, OnInit } from '@angular/core';
     import { ClienteDetalleComponent} from './cliente-detalle.component';
     import { FormGroup, FormControl, Validators } from '@angular/forms';
     import {NgbDateStruct} from '@ng-bootstrap/ng-bootstrap';
     import { Cliente } from '../../clases/cliente';
     import { CoreService } from '../../services/core.service';


    @Component({
    selector: 'app-cliente-deuda',
    templateUrl: './cliente-deuda.component.html',
    styles: []
    })
    export class ClienteDeudaComponent implements OnInit {
     data: Cliente;
    constructor(private coreService: CoreService) {}

      ngOnInit() {
       this.data = this.coreService.getData();

    }
  }

and this is my urlTemplate

<h4>Detalle de Deudas</h4>
<table class="table table-hover">
    <thead>
        <tr>
            <th>Acreedor</th>
            <th>TipoDeuda</th>
            <th>SituaciĆ³n</th>
            <th>Propuestas</th>
            <th>Monto Deuda</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td></td>
            <td></td>

        </tr>
    </tbody>
</table>

in this.data i have all my prop of the object, but i cannot display in a table or grid.

thanks a lot!

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/10/18/bind-a-table-from-an-object-in-angular/
via @lzomedia #developer #freelance #web #lzomedia.com

No comments:

Post a Comment