Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(exporters): add providedIn root to exporters #10220

Merged
merged 9 commits into from
Oct 7, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ export class IgxGridToolbarExporterComponent extends BaseToolbarDirective {

constructor(
@Host() protected toolbar: IgxGridToolbarComponent,
@Optional() private excelExporter: IgxExcelExporterService,
@Optional() private csvExporter: IgxCsvExporterService,
private excelExporter: IgxExcelExporterService,
private csvExporter: IgxCsvExporterService,
) {
super(toolbar);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export interface ICsvExportEndedEventArgs extends IBaseEventArgs {
* this.csvExportService.exportData(this.localData, opt);
* ```
*/
@Injectable()
@Injectable({
providedIn: 'root',
})
export class IgxCsvExporterService extends IgxBaseExporter {
/**
* This event is emitted when the export process finishes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ const EXCEL_MAX_COLS = 16384;
* this.excelExportService.exportData(this.localData, new IgxExcelExporterOptions("FileName"));
* ```
*/
@Injectable()
@Injectable({
providedIn: 'root',
})
export class IgxExcelExporterService extends IgxBaseExporter {
private static ZIP_OPTIONS = { compression: 'DEFLATE', type: 'base64' } as JSZip.JSZipGeneratorOptions<'base64'>;

Expand Down
4 changes: 1 addition & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';
import {
IgxIconModule, IgxBottomNavModule, IgxGridModule, IgxExcelExporterService, IgxCsvExporterService, IgxOverlayService,
IgxIconModule, IgxBottomNavModule, IgxGridModule, IgxOverlayService,
IgxDragDropModule, IgxDividerModule, IgxTreeGridModule, IgxHierarchicalGridModule, IgxInputGroupModule,
IgxIconService, DisplayDensityToken, DisplayDensity,
IgxDateTimeEditorModule, IgxDateRangePickerModule, IgxButtonModule, IgxActionStripModule, GridBaseAPIService, IgxButtonGroupModule,
Expand Down Expand Up @@ -327,9 +327,7 @@ const components = [
HierarchicalRemoteService,
GridBaseAPIService,
IgxGridHierarchicalPipe,
IgxExcelExporterService,
IgxIconService,
IgxCsvExporterService,
IgxOverlayService,
{ provide: DisplayDensityToken, useFactory: () => ({ displayDensity: DisplayDensity.comfortable }) },
{
Expand Down