How To Use Devextreme In Angular?

DevExtreme is a collection of enterprise-ready Angular, React, Vue, and jQuery UI component suites. It includes everything you’ll need to build responsive web apps for touch devices and standard PCs, including a data grid, interactive charts, data editors, navigation, and multi-purpose widgets.

install a Devextreme in anguler

npx -p devextreme-cli devextreme add devextreme-angular
npm run start

This command does the following:

  • Adds the devextreme and devextreme-angular npm packages to the dependencies in package.json and installs their latest versions.
  • References the dx.light.css DevExtreme stylesheet in angular.json.

Import the DevExtreme UI component module into the NgModule where it will be used.

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

Configure the DevExtreme UI component in the markup,

Static String Property Value 


<dx-button text="Simple button"></dx-button>


import { DxButtonModule } from 'devextreme-angular';

Properties of the Object Type

Use UI components prefixed with dxo- (“o” stands for “object”). In the following example, we configure the TreeMap’s tooltip property:



Use UI components that begin with dxi- (“i” stands for “item”). The following example demonstrates how to set the columns property of the DataGrid

    <dxi-column dataField="firstName" caption="First Name"></dxi-column>
    <dxi-column dataField="lastName" caption="Last Name" [visible]="false"></dxi-column>

The dxi-item dxi-element is used to define elements in collection UI components. It supports the structural directives offered by Angular, such as ngFor. The code below demonstrates how to define items in the List UI component using dxi-item.

In addition, dxi-item provides directives that affect aspects of item presentation, such as badge in the code below. Each collection UI component’s items section describes them.


        <h1>Available items</h1>
    <dxi-item *ngFor="let item of listItems" [badge]="item.badge">


// ...
export class AppComponent {
    listItems = [{
        text: 'Cars',
        badge: '12'
    }, {
        text: 'Bikes',
        badge: '5'

Event Handling


In nested components, the () syntax cannot be used. Use the [] syntax instead:


    <dxi-column type="buttons">


import notify from "devextreme/ui/notify";
// ...
export class AppComponent {
    okClicked (e) {
        notify("The OK button was clicked")

Callback Functions



here defines a customizeLayers function but not use ( ).

Callback functions are executed outside the component’s context. If the context is important, explicitly bind the callback function to it in the constructor.

// ...
export class AppComponent {
    myCountry: string = "USA"; // we need to access this context variable in the callback function
    constructor() {
        this.customizeLayers = this.customizeLayers.bind(this);
    customizeLayers(elements) {
        let country = this.myCountry;
        // ...

One-Way Property Binding

Changes in the bindingProperty are propagated to TextBox’s value, but not vice versa. like.

<dx-text-box [value]="bindingProperty"></dx-text-box>

Two-Way Property Binding

Changes in the bindingProperty are propagated to the TextBox’s value and vice versa:


<dx-text-box [(value)]="bindingProperty"></dx-text-box>


// ...
export class AppComponent {
    bindingProperty: string = "Some value";

Submit a Comment

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


Select Categories