Advertisement
Guest User

tableMaterial

a guest
Jan 9th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import {Component, OnInit, ViewChild} from '@angular/core';
  2. import {MatPaginator, MatTableDataSource} from '@angular/material';
  3.  
  4. @Component({
  5.   selector: 'app-tidak-ada',
  6.   styleUrls: ['./tidak-ada.component.css'],
  7.   templateUrl: './tidak-ada.component.html',
  8. })
  9.  
  10. export class TidakAdaComponent implements OnInit {
  11.  
  12.   displayedColumns: string[] = ['position', 'name', 'weight', 'symbol'];
  13.   dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
  14.  
  15.   @ViewChild(MatPaginator) paginator: MatPaginator;
  16.  
  17.   ngOnInit() {
  18.     this.dataSource.paginator = this.paginator;
  19.   }
  20. }
  21.  
  22. export interface PeriodicElement {
  23.   name: string;
  24.   position: number;
  25.   weight: number;
  26.   symbol: string;
  27. }
  28.  
  29. const ELEMENT_DATA: PeriodicElement[] = [
  30.   {position: 1, name: 'Hydrogen', weight: 1.0079, symbol: 'H'},
  31.   {position: 2, name: 'Helium', weight: 4.0026, symbol: 'He'},
  32.   {position: 3, name: 'Lithium', weight: 6.941, symbol: 'Li'},
  33.   {position: 4, name: 'Beryllium', weight: 9.0122, symbol: 'Be'},
  34.   {position: 5, name: 'Boron', weight: 10.811, symbol: 'B'},
  35.   {position: 6, name: 'Carbon', weight: 12.0107, symbol: 'C'},
  36.   {position: 7, name: 'Nitrogen', weight: 14.0067, symbol: 'N'},
  37.   {position: 8, name: 'Oxygen', weight: 15.9994, symbol: 'O'},
  38.   {position: 9, name: 'Fluorine', weight: 18.9984, symbol: 'F'},
  39.   {position: 10, name: 'Neon', weight: 20.1797, symbol: 'Ne'},
  40.   {position: 11, name: 'Sodium', weight: 22.9897, symbol: 'Na'},
  41.   {position: 12, name: 'Magnesium', weight: 24.305, symbol: 'Mg'},
  42.   {position: 13, name: 'Aluminum', weight: 26.9815, symbol: 'Al'},
  43.   {position: 14, name: 'Silicon', weight: 28.0855, symbol: 'Si'},
  44.   {position: 15, name: 'Phosphorus', weight: 30.9738, symbol: 'P'},
  45.   {position: 16, name: 'Sulfur', weight: 32.065, symbol: 'S'},
  46.   {position: 17, name: 'Chlorine', weight: 35.453, symbol: 'Cl'},
  47.   {position: 18, name: 'Argon', weight: 39.948, symbol: 'Ar'},
  48.   {position: 19, name: 'Potassium', weight: 39.0983, symbol: 'K'},
  49.   {position: 20, name: 'Calcium', weight: 40.078, symbol: 'Ca'},
  50. ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement