Mercurial > hg > ng2-query-ismi
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 47:b65a031c4967 | 48:f8d6f8479e77 |
|---|---|
| 1 import {Component} from '@angular/core'; | 1 import {Component} from '@angular/core'; |
| 2 | 2 |
| 3 @Component({ | 3 @Component({ |
| 4 selector: 'tr.resultRow', | 4 selector: 'tr.resultRow', |
| 5 template: ` | 5 template: ` |
| 6 <td style="vertical-align: top;" | 6 <ng-container *ngIf="rowType=='node'"> |
| 7 *ngIf="rowType=='node'" *ngFor="let col of columns"> | 7 <td style="vertical-align: top;" |
| 8 *ngFor="let col of columns"> | |
| 8 <a *ngIf="col && col.name=='link'" href="{{rowData[col.name]}}" target="_blank">Link</a> | 9 <a *ngIf="col && col.name=='link'" href="{{rowData[col.name]}}" target="_blank">Link</a> |
| 9 <span *ngIf="col && col.name!='link'">{{rowData[col.name]}}</span> | 10 <span *ngIf="col && col.name!='link'">{{rowData[col.name]}}</span> |
| 10 </td> | 11 </td> |
| 11 | 12 </ng-container> |
| 12 <td style="vertical-align: top;" | 13 <ng-container *ngIf="rowType=='text'"> |
| 13 *ngIf="rowType=='text'">{{rowData}}</td> | 14 <td style="vertical-align: top;">{{rowData}}</td> |
| 15 </ng-container> | |
| 14 `, | 16 `, |
| 15 inputs: ['rowData', 'rowType', 'columns'] | 17 inputs: ['rowData', 'rowType', 'columns'] |
| 16 }) | 18 }) |
| 17 | 19 |
| 18 export class QueryResultRowComponent { | 20 export class QueryResultRowComponent { |
| 19 | 21 |
| 20 public rowType: string; | 22 public rowType: string; |
| 21 public rowData: any; | 23 public rowData: any; |
| 22 public columns: any[]; | 24 public columns: any[]; |
| 23 | 25 |
| 24 /* ngOnInit() { | 26 ngOnInit() { |
| 25 console.debug("row init! columns=", this.columns, " rowData=", this.rowData); | 27 console.debug("row init! rowType=", this.rowType, " columns=", this.columns, " rowData=", this.rowData); |
| 26 } */ | 28 } |
| 27 } | 29 } |
