Categories

Thursday, March 28, 2024
#919814419350 therichposts@gmail.com
Angular 10Angular 9Javascript

Angular 10 Smart Table Working Example

Angular 9, Angular 10

Hello to all, welcome to therichpost.com. In this post, I will tell you, Angular 10 Smart Table Working Example.

Angular 10 came and I am very happy for this and If you are new then you can check my Angular 10 old posts with that you can Angular 10 easily.

Post Working:

In this post, I am implementing smart table into my angular 10 application. With this table, you will get default, searching, filtering, add, update and delete features.

Here are the commands and code snippet and please follow carefully:

1. After setting the Angular 10 project, you need to run below commands for add smart table feature into your angular 10 application:

npm install --save ng2-smart-table

npm i @akveo/ng2-completer --save

2. Here is the code, you need to add into your app.module.ts file:

...
import { Ng2SmartTableModule } from 'ng2-smart-table';
...

// ...

@NgModule({
  imports: [
    // ...
    
    Ng2SmartTableModule,
    
    // ...
  ],
  declarations: [ ... ]
})
// ...

3. Here is the code, you need to add your app.component.ts file:

...
export class AppComponent { settings = {
  columns: {
    id: {
      title: 'ID'
    },
    name: {
      title: 'Full Name'
    },
    username: {
      title: 'User Name'
    },
    email: {
      title: 'Email'
    }
  }
};

data = [
  {
    id: 1,
    name: "test Graham",
    username: "Bret",
    email: "test@april.com"
  },
  {
    id: 2,
    name: "test Howell",
    username: "test",
    email: "test@gmail.tv"
  },
  {
    id: 11,
    name: "testDuBuque",
    username: "test.Stanton",
    email: "test@test.biz"
  }
]; }
...

 

3. Here is code, you need to add into your app.component.html file:

<ng2-smart-table [settings]="settings" [source]="data"></ng2-smart-table>

 

This is it and if you have any kind of query then please do comment below.

Jassa

Thank you

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.