This project was generated with Angular CLI version 15.0.5.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The application will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI Overview and Command Reference page.
ng add angular-datatables
- Select datatable type ( DataTables (Default) )
npm install jquery --save
npm install datatables.net --save
npm install datatables.net-dt --save
npm install angular-datatables --save
npm install @types/jquery --save-dev
npm install @types/datatables.net --save-dev
import { DataTablesModule } from "angular-datatables";
imports: [DataTablesModule]
"projects": {
"your-app-name": {
"architect": {
"build": {
"options": {
"styles": [
"node_modules/datatables.net-dt/css/jquery.dataTables.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.js",
"node_modules/datatables.net/js/jquery.dataTables.js"
]
}
}
cloumns = ['Id', 'firstName', 'lastName']
employeeList = [
{ Id: 1, firstName: "John", lastName: "Doe" },
{ Id: 2, firstName: "Jane", lastName: "Smith" },
{ Id: 3, firstName: "Bob", lastName: "Johnson" }
];
<table datatable class="row-border hover">
<thead>
<tr>
<th *ngFor="let column of cloumns">{{ column }}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let emp of employeeList">
<td>{{ emp.Id }}</td>
<td>{{ emp.firstName }}</td>
<td>{{ emp.lastName }}</td>
</tr>
</tbody>
</table>