How To Add DevExtreme In Angular Application

Hello Friends, In this article, we will learn how to add DexExtreme In an angular application and how to use DexExtreme DataGrid in angular.

To start this article, you need an Angular 7+ application created using the Angular CLI.

First, we need to install devextreme in our angular project

npm install devextreme@20.2 devextreme-angular@20.2 --save --save-exact

After you run the command, We Configure Stylesheets Open the angular.json file and reference dx.common.css and a predefined theme stylesheet (dx.light.css in the code below).

  "projects": {
    "ProjectName": {
      "architect": {
        "build": {
          "options": {
            "styles": [

Then, go to the src folder, open the index.html file, and add the dx-viewport class in the <body> tag. This ensures theme colors applied to all pages.

        <!-- ... -->
    <body class="dx-viewport">

Then, go to the NgModule and import the required DevExtreme modules.

// ...
import { DxDataGridModule } from 'devextreme-angular';
    imports: [
        // ...
    // ...
export class AppModule { }

Now, add DataGrid in the app.component.html page.

    <dxo-paging [pageSize]="10"></dxo-paging>
        [allowedPageSizes]="[10, 20, 50, 100]"
    <dxi-column dataField="companyName"></dxi-column>
    <dxi-column dataField="city"></dxi-column>
    <dxi-column dataField="state"></dxi-column>
    <dxi-column dataField="phone"></dxi-column>
    <dxi-column dataField="fax"></dxi-column>

We are filled data in the grid using API, put the below code in the app.component.ts file.

export class AppComponent {

  dataSource: any;

    private http: HttpClient
  ) { }

  ngOnInit(): void {
      .subscribe(data => {
        this.dataSource = data;

Now run the application and see the result look like below

I hope this article helps you and you will like it.

Submit a Comment

Your email address will not be published. Required fields are marked *


Select Categories