DevExtreme Angular - Using Ionic

NOTE
This tutorial is intended for use with the latest version of Ionic. Compatibility with earlier versions is not guaranteed.

Install DevExtreme

Install the devextreme and devextreme-angular npm packages:

npm install devextreme@19.1 devextreme-angular@19.1 --save --save-exact
NOTE
We recommend saving an exact version of DevExtreme to avoid unexpected updates because DevExtreme does not use Semantic Versioning. In our versioning system, the first and middle numbers indicate a major release which may contain behavior changes.

Import Stylesheets

Open the global.scss file in the src folder and import dx.common.css and a predefined theme stylesheet (dx.light.css in the code below).

global.scss
@import '~devextreme/dist/css/dx.common.css';
@import '~devextreme/dist/css/dx.light.css';
NOTE
SVG-based widgets do not require theme stylesheets. If you do import the stylesheets, the widgets apply an appearance that matches them.

Import DevExtreme Modules

Go to the NgModule in which you are going to use DevExtreme components and import the required DevExtreme modules. Note that if tree shaking is configured in your application, you can import the modules from devextreme-angular. Otherwise, you should import them from specific files.

app.module.ts
// ...
import { DxButtonModule } from 'devextreme-angular';
// or if tree shaking is not configured
// import { DxButtonModule } from 'devextreme-angular/ui/button';

@NgModule({
    imports: [
        // ...
        DxButtonModule
    ],
    // ...
})
export class AppModule { }

Now you can use the DevExtreme component in your application:

app.component.html
app.component.ts
<dx-button
    text="Click me"
    (onClick)="helloWorld()">
</dx-button>
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    helloWorld() {
        alert('Hello world!');
    }
}

Register 3rd-Party Dependencies

The DataGrid widget and Globalize localization require additional libraries. Follow the instructions from the Register 3rd-Party Dependencies in Angular CLI 6+ article.

Run the Application

Run the application with the following command:

ionic serve

Open http://localhost:8100/ to browse the application.

Demos and Code Examples

Refer to the following resources for code samples and usage examples: