Skip to content

Commit a910d5f

Browse files
fix demos to angular 21 syntax
1 parent a874190 commit a910d5f

File tree

2 files changed

+26
-40
lines changed

2 files changed

+26
-40
lines changed

apps/demos/Demos/Diagram/ItemSelection/Angular/app/app.component.ts

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import {
2-
NgModule, Component, Pipe, PipeTransform, enableProdMode,
2+
Component, Pipe, PipeTransform, enableProdMode, provideZoneChangeDetection,
33
} from '@angular/core';
4-
import { BrowserModule } from '@angular/platform-browser';
5-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
6-
import { provideHttpClient, withFetch } from '@angular/common/http';
4+
import { bootstrapApplication } from '@angular/platform-browser';
75
import { ArrayStore } from 'devextreme-angular/common/data';
86
import { DxDiagramModule, DxDiagramTypes } from 'devextreme-angular/ui/diagram';
97
import { Service } from './app.service';
@@ -18,13 +16,25 @@ if (window && window.config?.packageConfigPaths) {
1816
modulePrefix = '/app';
1917
}
2018

19+
@Pipe({ name: 'stringifyItems', standalone: true })
20+
export class StringifyItemsPipe implements PipeTransform {
21+
transform(items: DxDiagramTypes.Item[], textExpression: string): string {
22+
return items
23+
.map((item) => item.dataItem[textExpression])
24+
.join(', ');
25+
}
26+
}
27+
2128
@Component({
22-
standalone: false,
2329
selector: 'demo-app',
2430
templateUrl: `.${modulePrefix}/app.component.html`,
2531
styleUrls: [`.${modulePrefix}/app.component.css`],
2632
providers: [Service],
2733
preserveWhitespaces: true,
34+
imports: [
35+
DxDiagramModule,
36+
StringifyItemsPipe,
37+
],
2838
})
2939
export class AppComponent {
3040
dataSource: ArrayStore;
@@ -56,25 +66,8 @@ export class AppComponent {
5666
}
5767
}
5868

59-
@Pipe({ name: 'stringifyItems', standalone: true })
60-
export class StringifyItemsPipe implements PipeTransform {
61-
transform(items: DxDiagramTypes.Item[], textExpression: string): string {
62-
return items
63-
.map((item) => item.dataItem[textExpression])
64-
.join(', ');
65-
}
66-
}
67-
68-
@NgModule({
69-
imports: [
70-
BrowserModule,
71-
DxDiagramModule,
72-
StringifyItemsPipe,
69+
bootstrapApplication(AppComponent, {
70+
providers: [
71+
provideZoneChangeDetection({ eventCoalescing: true, runCoalescing: true }),
7372
],
74-
providers: [provideHttpClient(withFetch())],
75-
declarations: [AppComponent],
76-
bootstrap: [AppComponent],
77-
})
78-
export class AppModule { }
79-
80-
platformBrowserDynamic().bootstrapModule(AppModule);
73+
});

apps/demos/Demos/List/DragAndDrop/Angular/app/app.component.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { NgModule, Component, enableProdMode } from '@angular/core';
2-
import { BrowserModule } from '@angular/platform-browser';
3-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
1+
import { Component, enableProdMode, provideZoneChangeDetection } from '@angular/core';
2+
import { bootstrapApplication } from '@angular/platform-browser';
43
import { DxListModule } from 'devextreme-angular';
54
import { DxSortableTypes } from 'devextreme-angular/ui/sortable';
65
import { Task, Service } from './app.service';
@@ -18,12 +17,12 @@ if (window && window.config?.packageConfigPaths) {
1817
}
1918

2019
@Component({
21-
standalone: false,
2220
selector: 'demo-app',
2321
providers: [Service],
2422
templateUrl: `.${modulePrefix}/app.component.html`,
2523
styleUrls: [`.${modulePrefix}/app.component.css`],
2624
preserveWhitespaces: true,
25+
imports: [DxListModule],
2726
})
2827
export class AppComponent {
2928
doingTasks: Task[];
@@ -53,14 +52,8 @@ export class AppComponent {
5352
};
5453
}
5554

56-
@NgModule({
57-
imports: [
58-
BrowserModule,
59-
DxListModule,
55+
bootstrapApplication(AppComponent, {
56+
providers: [
57+
provideZoneChangeDetection({ eventCoalescing: true, runCoalescing: true }),
6058
],
61-
declarations: [AppComponent],
62-
bootstrap: [AppComponent],
63-
})
64-
export class AppModule { }
65-
66-
platformBrowserDynamic().bootstrapModule(AppModule);
59+
});

0 commit comments

Comments
 (0)