|
| 1 | +/** |
| 2 | + * @license |
| 3 | + * Copyright Google LLC All Rights Reserved. |
| 4 | + * |
| 5 | + * Use of this source code is governed by an MIT-style license that can be |
| 6 | + * found in the LICENSE file at https://angular.io/license |
| 7 | + */ |
| 8 | + |
| 9 | +import {Component} from '@angular/core'; |
| 10 | + |
| 11 | +export interface PeriodicElement { |
| 12 | + name: string; |
| 13 | + position: number; |
| 14 | + weight: number; |
| 15 | + symbol: string; |
| 16 | +} |
| 17 | + |
| 18 | +const ELEMENT_DATA: PeriodicElement[] = [ |
| 19 | + {position: 1, name: 'Hydrogen', weight: 1.0079, symbol: 'H'}, |
| 20 | + {position: 2, name: 'Helium', weight: 4.0026, symbol: 'He'}, |
| 21 | + {position: 3, name: 'Lithium', weight: 6.941, symbol: 'Li'}, |
| 22 | + {position: 4, name: 'Beryllium', weight: 9.0122, symbol: 'Be'}, |
| 23 | + {position: 5, name: 'Boron', weight: 10.811, symbol: 'B'}, |
| 24 | + {position: 6, name: 'Carbon', weight: 12.0107, symbol: 'C'}, |
| 25 | + {position: 7, name: 'Nitrogen', weight: 14.0067, symbol: 'N'}, |
| 26 | + {position: 8, name: 'Oxygen', weight: 15.9994, symbol: 'O'}, |
| 27 | + {position: 9, name: 'Fluorine', weight: 18.9984, symbol: 'F'}, |
| 28 | + {position: 10, name: 'Neon', weight: 20.1797, symbol: 'Ne'}, |
| 29 | +]; |
| 30 | + |
| 31 | +@Component({ |
| 32 | + selector: 'mdc-table-demo', |
| 33 | + templateUrl: 'mdc-table-demo.html', |
| 34 | + styleUrls: ['mdc-table-demo.css'], |
| 35 | +}) |
| 36 | +export class MdcTableDemo { |
| 37 | + displayedColumns: string[] = ['position', 'name', 'weight', 'symbol']; |
| 38 | + dataSource = ELEMENT_DATA; |
| 39 | +} |
0 commit comments