File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed
src/universal-app/kitchen-sink Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -227,3 +227,15 @@ <h2>Expansion Panel</h2>
227
227
This is the content text that makes sense here.
228
228
< md-action-row > Action</ md-action-row >
229
229
</ md-expansion-panel >
230
+
231
+ < h2 > CDK Table</ h2 >
232
+
233
+ < cdk-table #table [dataSource] ="cdkTableDataSource ">
234
+ < ng-container cdkColumnDef ="userId ">
235
+ < cdk-header-cell *cdkHeaderCellDef > ID</ cdk-header-cell >
236
+ < cdk-cell *cdkCellDef ="let row "> {{row.userId}}</ cdk-cell >
237
+ </ ng-container >
238
+
239
+ < cdk-header-row *cdkHeaderRowDef ="cdkTableColumns " > </ cdk-header-row >
240
+ < cdk-row *cdkRowDef ="let row; columns: cdkTableColumns; "> </ cdk-row >
241
+ </ cdk-table >
Original file line number Diff line number Diff line change 1
1
import { Component , NgModule } from '@angular/core' ;
2
2
import { ServerModule } from '@angular/platform-server' ;
3
3
import { BrowserModule } from '@angular/platform-browser' ;
4
+ import { Observable } from 'rxjs/Observable' ;
4
5
import {
5
6
MdAutocompleteModule ,
6
7
MdButtonModule ,
@@ -29,14 +30,33 @@ import {
29
30
MdToolbarModule ,
30
31
MdTooltipModule ,
31
32
} from '@angular/material' ;
33
+ import {
34
+ CdkTableModule ,
35
+ DataSource
36
+ } from '@angular/cdk/table' ;
32
37
38
+ import 'rxjs/add/observable/of' ;
33
39
34
40
@Component ( {
35
41
selector : 'kitchen-sink' ,
36
42
templateUrl : './kitchen-sink.html' ,
37
43
styleUrls : [ './kitchen-sink.css' ] ,
38
44
} )
39
- export class KitchenSink { }
45
+ export class KitchenSink {
46
+
47
+ /** List of columns for the CDK table. */
48
+ cdkTableColumns = [ 'userId' ] ;
49
+
50
+ /** Data source for the CDK table. */
51
+ cdkTableDataSource : DataSource < any > = {
52
+ connect : ( ) => Observable . of ( [
53
+ { userId : 1 } ,
54
+ { userId : 2 }
55
+ ] ) ,
56
+ disconnect : ( ) => { }
57
+ } ;
58
+
59
+ }
40
60
41
61
42
62
@NgModule ( {
@@ -70,7 +90,10 @@ export class KitchenSink { }
70
90
MdTabsModule ,
71
91
MdToolbarModule ,
72
92
MdTooltipModule ,
73
- MdExpansionModule
93
+ MdExpansionModule ,
94
+
95
+ // CDK Modules
96
+ CdkTableModule
74
97
] ,
75
98
bootstrap : [ KitchenSink ] ,
76
99
declarations : [ KitchenSink ] ,
You can’t perform that action at this time.
0 commit comments