From 59a582562a0bc88fa1183e2fe94f956de104d7f3 Mon Sep 17 00:00:00 2001 From: Frederic Ghilini Date: Wed, 7 Jun 2017 10:34:19 +0200 Subject: [PATCH] Code review --- src/demo-app/src/app/app.component.ts | 4 +++- src/lib/md-datatable.component.ts | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/demo-app/src/app/app.component.ts b/src/demo-app/src/app/app.component.ts index 8b8de22..186fa67 100644 --- a/src/demo-app/src/app/app.component.ts +++ b/src/demo-app/src/app/app.component.ts @@ -4,6 +4,7 @@ import { AfterViewInit, OnDestroy, ViewChild, + ChangeDetectorRef, } from '@angular/core'; import { Observable } from 'rxjs/Observable'; @@ -49,7 +50,7 @@ export class AppComponent implements AfterViewInit, OnDestroy { private unmount$: Subject = new Subject(); - constructor(private appService: AppService) { + constructor(private appService: AppService, private changeDetectorRef: ChangeDetectorRef) { this.fetchDemoDataSource(); } @@ -82,6 +83,7 @@ export class AppComponent implements AfterViewInit, OnDestroy { shuffleData() { this.tshirts$.next(shuffle(this.tshirts$.getValue())); this.currentSelection$.next([]); + this.changeDetectorRef.detectChanges(); } private fetchDemoDataSource( diff --git a/src/lib/md-datatable.component.ts b/src/lib/md-datatable.component.ts index adb6008..503408f 100644 --- a/src/lib/md-datatable.component.ts +++ b/src/lib/md-datatable.component.ts @@ -9,7 +9,6 @@ import { ContentChild, ContentChildren, QueryList, - forwardRef, } from '@angular/core'; import { Observable } from 'rxjs/Observable'; @@ -53,8 +52,8 @@ export class MdDataTableComponent extends BaseComponent implements AfterContentI @Output() sortChange: EventEmitter = new EventEmitter(false); - @ContentChild(forwardRef(() => MdDataTableHeaderComponent)) headerCmp: MdDataTableHeaderComponent; - @ContentChildren(forwardRef(() => MdDataTableRowComponent)) rowsCmp: QueryList; + @ContentChild(MdDataTableHeaderComponent) headerCmp: MdDataTableHeaderComponent; + @ContentChildren(MdDataTableRowComponent) rowsCmp: QueryList; id = `md-datatable-${instanceId++}`;