Skip to content

Instantly share code, notes, and snippets.

@cchng
Created August 15, 2018 05:50
Show Gist options
  • Select an option

  • Save cchng/eb2a0e054db45f1a7abbb7fa50b47603 to your computer and use it in GitHub Desktop.

Select an option

Save cchng/eb2a0e054db45f1a7abbb7fa50b47603 to your computer and use it in GitHub Desktop.

Revisions

  1. cchng revised this gist Aug 15, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion table.component.ts
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ export class MyObjectComponent implements OnInit {


    ngOnInit() {
    // api returns json containing data
    // api returns json containing data with columnDef fields as keys
    // TODO: figure out how to get nested data
    this.rowData = this.http.get('http://localhost:3000/api/myobject');
    }
  2. cchng created this gist Aug 15, 2018.
    30 changes: 30 additions & 0 deletions table.component.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    import { Component, OnDestroy, OnInit } from '@angular/core';
    import { HttpClient } from '@angular/common/http';
    import { AgGridModule } from 'ag-grid-angular';


    @Component({
    templateUrl: 'myobject.component.html'
    })

    export class MyObjectComponent implements OnInit {
    title = 'app';

    columnDefs = [
    {headerName: 'Object Name', field: 'object_name' },
    {headerName: 'Object Field 1', field: 'object_field_1' },
    ];

    rowData: any;

    constructor(private http: HttpClient) {

    }


    ngOnInit() {
    // api returns json containing data
    // TODO: figure out how to get nested data
    this.rowData = this.http.get('http://localhost:3000/api/myobject');
    }
    }