From b7de4adb7acb9f01c26373b8082243d5e1203bbf Mon Sep 17 00:00:00 2001 From: dtchau Date: Mon, 11 Apr 2016 07:08:56 -0400 Subject: [PATCH] feat(options): Allow access to properties that are deeper down the object tree. (fixes #81) --- components/table/ng-table.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/table/ng-table.component.ts b/components/table/ng-table.component.ts index a50d233..cad9a70 100644 --- a/components/table/ng-table.component.ts +++ b/components/table/ng-table.component.ts @@ -21,7 +21,7 @@ import {NgTableSorting} from './ng-table-sorting.directive'; - {{row[column.name]}} + {{getData(row, column.name)}} @@ -69,4 +69,8 @@ export class NgTable { this.columns = [column]; this.tableChanged.emit({sorting: this.configColumns}); } + + getData(row:any, propertyName:string) { + return propertyName.split('.').reduce((prev, curr) => prev[curr], row); + } }