view src/app/query-result-row.component.ts @ 48:f8d6f8479e77 ng2-final

first working version with angular 2.4 (using old table w/o pager).
author casties
date Mon, 20 Mar 2017 18:12:48 +0100
parents b65a031c4967
children
line wrap: on
line source

import {Component} from '@angular/core';

@Component({
    selector: 'tr.resultRow',
    template: `
        <ng-container *ngIf="rowType=='node'">
          <td style="vertical-align: top;"
            *ngFor="let col of columns">
            <a *ngIf="col && col.name=='link'" href="{{rowData[col.name]}}" target="_blank">Link</a>
            <span *ngIf="col && col.name!='link'">{{rowData[col.name]}}</span>
          </td>
        </ng-container>
        <ng-container *ngIf="rowType=='text'">
          <td style="vertical-align: top;">{{rowData}}</td>
        </ng-container>
        `,
    inputs: ['rowData', 'rowType', 'columns']
})
   
export class QueryResultRowComponent { 
    
    public rowType: string;
    public rowData: any;
    public columns: any[];
    
    ngOnInit() {
        console.debug("row init! rowType=", this.rowType, " columns=", this.columns, " rowData=", this.rowData);
    }
}