Skip to content

Commit e991b47

Browse files
authored
Merge pull request #10251 from IgniteUI/dmdimitrov/exporters-import-12.2.x
feat(exporters): add providedIn root to exporters - 12.2.x
2 parents dad5279 + c119b38 commit e991b47

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes for each version of this project will be documented in this file.
44

5+
## 12.2.1
6+
7+
### New Features
8+
- `IgxCsvExporterService`, `IgxExcelExporterService`
9+
- Exporter services are no longer required to be provided in the application since they are now injected on a root level.
10+
511
## 12.2.0
612

713
### New Features

projects/igniteui-angular/src/lib/grids/toolbar/grid-toolbar-exporter.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ export class IgxGridToolbarExporterComponent extends BaseToolbarDirective {
108108

109109
constructor(
110110
@Host() protected toolbar: IgxGridToolbarComponent,
111-
@Optional() private excelExporter: IgxExcelExporterService,
112-
@Optional() private csvExporter: IgxCsvExporterService,
111+
private excelExporter: IgxExcelExporterService,
112+
private csvExporter: IgxCsvExporterService,
113113
) {
114114
super(toolbar);
115115
}

projects/igniteui-angular/src/lib/services/csv/csv-exporter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ export interface ICsvExportEndedEventArgs extends IBaseEventArgs {
3131
* this.csvExportService.exportData(this.localData, opt);
3232
* ```
3333
*/
34-
@Injectable()
34+
@Injectable({
35+
providedIn: 'root',
36+
})
3537
export class IgxCsvExporterService extends IgxBaseExporter {
3638
/**
3739
* This event is emitted when the export process finishes.

projects/igniteui-angular/src/lib/services/excel/excel-exporter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ const EXCEL_MAX_COLS = 16384;
3939
* this.excelExportService.exportData(this.localData, new IgxExcelExporterOptions("FileName"));
4040
* ```
4141
*/
42-
@Injectable()
42+
@Injectable({
43+
providedIn: 'root',
44+
})
4345
export class IgxExcelExporterService extends IgxBaseExporter {
4446
private static ZIP_OPTIONS = { compression: 'DEFLATE', type: 'base64' } as JSZip.JSZipGeneratorOptions<'base64'>;
4547

src/app/app.module.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
55
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
66
import { NgModule } from '@angular/core';
77
import {
8-
IgxIconModule, IgxBottomNavModule, IgxGridModule, IgxExcelExporterService, IgxCsvExporterService, IgxOverlayService,
8+
IgxIconModule, IgxBottomNavModule, IgxGridModule, IgxOverlayService,
99
IgxDragDropModule, IgxDividerModule, IgxTreeGridModule, IgxHierarchicalGridModule, IgxInputGroupModule,
1010
IgxIconService, DisplayDensityToken, DisplayDensity,
1111
IgxDateTimeEditorModule, IgxDateRangePickerModule, IgxButtonModule, IgxActionStripModule, GridBaseAPIService, IgxButtonGroupModule,
@@ -327,9 +327,7 @@ const components = [
327327
HierarchicalRemoteService,
328328
GridBaseAPIService,
329329
IgxGridHierarchicalPipe,
330-
IgxExcelExporterService,
331330
IgxIconService,
332-
IgxCsvExporterService,
333331
IgxOverlayService,
334332
{ provide: DisplayDensityToken, useFactory: () => ({ displayDensity: DisplayDensity.comfortable }) },
335333
{

0 commit comments

Comments
 (0)