angular material table
JavaScript
component-name.component.ts:
-----------------------------
import {Component} from '@angular/core';
export interface PeriodicElement {
name: string;
position: number;
weight: number;
symbol: string;
}
const ELEMENT_DATA: PeriodicElement[] = [
{position: 1, name: 'Hydrogen', weight: 1.0079, symbol: 'H'},
{position: 2, name: 'Helium', weight: 4.0026, symbol: 'He'},
{position: 3, name: 'Lithium', weight: 6.941, symbol: 'Li'},
{position: 4, name: 'Beryllium', weight: 9.0122, symbol: 'Be'},
{position: 5, name: 'Boron', weight: 10.811, symbol: 'B'},
{position: 6, name: 'Carbon', weight: 12.0107, symbol: 'C'},
{position: 7, name: 'Nitrogen', weight: 14.0067, symbol: 'N'},
{position: 8, name: 'Oxygen', weight: 15.9994, symbol: 'O'},
{position: 9, name: 'Fluorine', weight: 18.9984, symbol: 'F'},
{position: 10, name: 'Neon', weight: 20.1797, symbol: 'Ne'},
];
/**
* @title Basic use of `<table mat-table>`
*/
@Component({
selector: 'table-basic-example',
styleUrls: ['table-basic-example.css'],
templateUrl: 'table-basic-example.html',
})
export class TableBasicExample {
displayedColumns: string[] = ['position', 'name', 'weight', 'symbol'];
dataSource = ELEMENT_DATA;
}
component-name.component.html:
------------------------------
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<!--- Note that these columns can be defined in any order.
The actual rendered columns are set as a property on the row definition" -->
<!-- Position Column -->
<ng-container matColumnDef="position">
<th mat-header-cell *matHeaderCellDef> No. </th>
<td mat-cell *matCellDef="let element"> {{element.position}} </td>
</ng-container>
<!-- Name Column -->
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef> Name </th>
<td mat-cell *matCellDef="let element"> {{element.name}} </td>
</ng-container>
<!-- Weight Column -->
<ng-container matColumnDef="weight">
<th mat-header-cell *matHeaderCellDef> Weight </th>
<td mat-cell *matCellDef="let element"> {{element.weight}} </td>
</ng-container>
<!-- Symbol Column -->
<ng-container matColumnDef="symbol">
<th mat-header-cell *matHeaderCellDef> Symbol </th>
<td mat-cell *matCellDef="let element"> {{element.symbol}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
component-name.component.css:
----------------------------------
table {
width: 100%;
}
Also in JavaScript:
- Title
- fix a navbar to top of page js
- Category
- JavaScript
- Title
- captitalize js
- Category
- JavaScript
- Title
- how to make a tile generation system in javascript
- Category
- JavaScript
- Title
- Count number of nodes in each connected part of an undirected unweighted graph
- Category
- JavaScript
- Title
- how to do radio button validation in jquery
- Category
- JavaScript
- Title
- check if a key exists in an object javascript
- Category
- JavaScript
- Title
- chart.js on hover and onclick event
- Category
- JavaScript
- Title
- how to read 2 dimensional array in javascript
- Category
- JavaScript
- Title
- button not clicking for random jokes in javascript
- Category
- JavaScript
- Title
- Inserting HTML elements with JavaScript
- Category
- JavaScript
- Title
- divide intagers javascript
- Category
- JavaScript
- Title
- javascrip check if string contains substring
- Category
- JavaScript
- Title
- insertion sort js
- Category
- JavaScript
- Title
- detox scroll to element
- Category
- JavaScript
- Title
- javascript check if variable is a jquery object
- Category
- JavaScript
- Title
- character to ascii in js
- Category
- JavaScript
- Title
- exponential javascript
- Category
- JavaScript
- Title
- find all of array which satisfy condition javascript
- Category
- JavaScript
- Title
- how To fetch the index of dropdown using jquery
- Category
- JavaScript
- Title
- div background image chnage uisng js
- Category
- JavaScript
- Title
- draw rectangle on javascript canvas
- Category
- JavaScript
- Title
- How to write on a web page javascript
- Category
- JavaScript
- Title
- how to make a var and sprite in javascript
- Category
- JavaScript
- Title
- javascript check if argument is passed
- Category
- JavaScript
- Title
- copy php array to javascript
- Category
- JavaScript
- Title
- discord.js check for permissions
- Category
- JavaScript
- Title
- array of images javascript
- Category
- JavaScript
- Title
- (function (g, d, a) {})(window, document, jQuery);
- Category
- JavaScript
- Title
- floor in js
- Category
- JavaScript
- Title
- how to stringify json in js
- Category
- JavaScript
- Title
- how to pretty formatjson value on terminal ruby
- Category
- JavaScript
- Title
- angular check if control has required validator
- Category
- JavaScript
- Title
- difference between == and === in javascript
- Category
- JavaScript
- Title
- how to check if local storage variable exists in javascript
- Category
- JavaScript
- Title
- adjust() js
- Category
- JavaScript
- Title
- angular $http abort request
- Category
- JavaScript
- Title
- convert negative number to positive in javascript
- Category
- JavaScript
- Title
- how to clone an object
- Category
- JavaScript
- Title
- check node version
- Category
- JavaScript
- Title
- charat javascript
- Category
- JavaScript
- Title
- clone object in js
- Category
- JavaScript
- Title
- check if checkbox is checked jquery
- Category
- JavaScript
- Title
- add custom marker in react-mapbox-gl
- Category
- JavaScript
- Title
- javascript array map stack
- Category
- JavaScript
- Title
- how to use aos in react
- Category
- JavaScript
- Title
- iterate through array javascript
- Category
- JavaScript
- Title
- create a react native project
- Category
- JavaScript
- Title
- flexbox stretch height
- Category
- JavaScript
- Title
- angular @Input()
- Category
- JavaScript
- Title
- javascript check for duplicates in array
- Category
- JavaScript
- Title
- How can I know which radio button is selected via jQuery
- Category
- JavaScript
- Title
- async await catch error
- Category
- JavaScript
- Title
- default pool size in sequelize
- Category
- JavaScript
- Title
- Alert.alert closing expo
- Category
- JavaScript
- Title
- Javascript compare two objects
- Category
- JavaScript
- Title
- drupal 8 node has field
- Category
- JavaScript
- Title
- iso to date javascript
- Category
- JavaScript
- Title
- autocomplete typeahead ajax
- Category
- JavaScript
- Title
- how to get user ip address in javascript
- Category
- JavaScript
- Title
- add a slash to string in javascript
- Category
- JavaScript
- Title
- angularjs filter array of objects based on name prop
- Category
- JavaScript
- Title
- bot discord comment récupérer la pdp de quelqu'un
- Category
- JavaScript
- Title
- javascript change font color based on value
- Category
- JavaScript
- Title
- clear the console while in strict mode
- Category
- JavaScript
- Title
- how to calculate each row with on change table <td><input> jquery
- Category
- JavaScript
- Title
- firefox extension make ajax request
- Category
- JavaScript
- Title
- google maps react
- Category
- JavaScript
- Title
- import jquery in angular
- Category
- JavaScript
- Title
- compare two arrays
- Category
- JavaScript
- Title
- how to get nth fibonacci javascript
- Category
- JavaScript
- Title
- Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string. javascript
- Category
- JavaScript
- Title
- javascript access pushed element
- Category
- JavaScript
- Title
- discord js get badge user
- Category
- JavaScript
- Title
- how to find length of array in javascript without using length method
- Category
- JavaScript
- Title
- get text selected option jquery
- Category
- JavaScript
- Title
- how to print two arrays together
- Category
- JavaScript
- Title
- How to scan a folder for documents with javascript
- Category
- JavaScript
- Title
- javascript check if is nan
- Category
- JavaScript
- Title
- aws amplify get JWT TOKEN
- Category
- JavaScript
- Title
- inline javascript html
- Category
- JavaScript
- Title
- get json data when we get error code in axios
- Category
- JavaScript
- Title
- javascript click event notifications
- Category
- JavaScript
- Title
- javascript check if number is hexadecimal
- Category
- JavaScript
- Title
- cdn react
- Category
- JavaScript
- Title
- get all entries in object as array hjs
- Category
- JavaScript
- Title
- ajax laravel example
- Category
- JavaScript
- Title
- convert jquery to javascript
- Category
- JavaScript
- Title
- if mousepressed javascript
- Category
- JavaScript
- Title
- angular submit form programmatically
- Category
- JavaScript
- Title
- installing bootstrap in angular 9
- Category
- JavaScript
- Title
- how to right text with js
- Category
- JavaScript
- Title
- buble sort in js
- Category
- JavaScript
- Title
- choose random from array javascript
- Category
- JavaScript
- Title
- deep clone array in javascript
- Category
- JavaScript
- Title
- expresiones ternarias javascript
- Category
- JavaScript
- Title
- javascript change background color
- Category
- JavaScript
- Title
- how to write a program that displays a message “It’s Fun day” if it's Saturday or Sunday today in javascript
- Category
- JavaScript
- Title
- fcm-node Error: Invalid payload object at FCM.send
- Category
- JavaScript
- Title
- how to detect a keypress in javascript
- Category
- JavaScript
- Title
- angular stacked bar
- Category
- JavaScript