Skip to content

Commit 04fd076

Browse files
committed
refactor(crm): ng generate @angular/core:inject migration
1 parent e9ed976 commit 04fd076

2 files changed

Lines changed: 10 additions & 15 deletions

File tree

projects/app-crm/src/app/app.component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Inject, OnInit, DOCUMENT } from '@angular/core';
1+
import { Component, OnInit, DOCUMENT, inject } from '@angular/core';
22
import { SEOService } from '../../../app-lob/src/app/seo.service';
33
import { RouterOutlet } from '@angular/router';
44

@@ -10,12 +10,13 @@ import { RouterOutlet } from '@angular/router';
1010
imports: [RouterOutlet]
1111
})
1212
export class AppComponent implements OnInit {
13+
private seoService = inject(SEOService);
14+
private document = inject<Document>(DOCUMENT);
15+
1316
private title = 'Business propeller - Angular Data Grid Example';
1417
// eslint-disable-next-line max-len
1518
private metaDesc = 'In this angular grid example, you can see how users can customize their data view by leveraging the various features built into the grid.';
1619

17-
constructor(private seoService: SEOService, @Inject(DOCUMENT) private document: Document) { }
18-
1920
public ngOnInit() {
2021
this.seoService.updateHeadProperties(this.title, this.metaDesc, this.document.defaultView.location.href);
2122
}

projects/app-crm/src/app/grid-crm/grid-crm.component.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
/* eslint-disable no-underscore-dangle */
2-
import {
3-
AfterViewInit,
4-
Component,
5-
ElementRef,
6-
OnInit,
7-
QueryList,
8-
ViewChild
9-
} from '@angular/core';
2+
import { AfterViewInit, Component, ElementRef, OnInit, QueryList, ViewChild, inject } from '@angular/core';
103
import { ActivatedRoute } from '@angular/router';
114
import { CloseScrollStrategy, ConnectedPositioningStrategy, HorizontalAlignment, IColumnExportingEventArgs, IgxColumnComponent, IgxCsvExporterService, IgxDateSummaryOperand, IgxExcelExporterService, IgxGridComponent, IgxNumberSummaryOperand, IgxSummaryResult, IgxToggleDirective, OverlaySettings, PositionSettings, VerticalAlignment, CellType, GridSelectionMode, IgxGridToolbarComponent, IgxGridToolbarActionsComponent, IgxGridToolbarHidingComponent, IgxGridToolbarPinningComponent, IgxGridToolbarExporterComponent, IgxGridToolbarTitleComponent, IgxInputGroupComponent, IgxPrefixDirective, IgxIconComponent, IgxInputDirective, IgxSuffixDirective, IgxIconButtonDirective, IgxRippleDirective, IgxCellTemplateDirective, IgxAvatarComponent, IgxLinearProgressBarComponent } from 'igniteui-angular';
125
import { data, Employee } from './data';
@@ -78,6 +71,10 @@ class SoonSummary extends IgxDateSummaryOperand {
7871
imports: [NgClass, IgxGridComponent, IgxPreventDocumentScrollDirective, IgxGridToolbarComponent, IgxGridToolbarActionsComponent, IgxGridToolbarHidingComponent, IgxGridToolbarPinningComponent, IgxGridToolbarExporterComponent, IgxGridToolbarTitleComponent, IgxInputGroupComponent, IgxPrefixDirective, IgxIconComponent, FormsModule, IgxInputDirective, IgxSuffixDirective, IgxIconButtonDirective, IgxRippleDirective, IgxColumnComponent, IgxCellTemplateDirective, IgxAvatarComponent, IgxLinearProgressBarComponent]
7972
})
8073
export class GridCRMComponent implements OnInit, AfterViewInit {
74+
private csvExporter = inject(IgxCsvExporterService);
75+
private excelExporter = inject(IgxExcelExporterService);
76+
private activatedRoute = inject(ActivatedRoute);
77+
8178

8279
@ViewChild('grid1', { read: IgxGridComponent, static: true })
8380
public grid1!: IgxGridComponent;
@@ -117,10 +114,7 @@ export class GridCRMComponent implements OnInit, AfterViewInit {
117114
scrollStrategy: new CloseScrollStrategy()
118115
};
119116

120-
constructor(
121-
private csvExporter: IgxCsvExporterService,
122-
private excelExporter: IgxExcelExporterService,
123-
private activatedRoute: ActivatedRoute) {
117+
constructor() {
124118

125119
const exporterCb = (args: IColumnExportingEventArgs) => {
126120
if (args.field === 'Deals') { args.cancel = true; }

0 commit comments

Comments
 (0)