refactor(*): migrate DI from constructors to inject() API#16075
refactor(*): migrate DI from constructors to inject() API#16075
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the Ignite UI for Angular component library to use Angular's inject() API instead of constructor-based dependency injection, aligning with modern Angular best practices.
Key Changes:
- Migration from constructor parameters to
inject()function for dependency injection - Updates to test files to use
TestBedfor component instantiation instead of manual constructors - Conversion of injection tokens from string literals to
InjectionTokenobjects
Reviewed Changes
Copilot reviewed 278 out of 278 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| projects/igniteui-angular/src/lib/tree/tree.component.ts | Migrated constructor DI to inject() API |
| projects/igniteui-angular/src/lib/tree/tree-node/tree-node.component.ts | Replaced constructor injection with inject() calls |
| projects/igniteui-angular/src/lib/tree/tree.spec.ts | Updated tests to use TestBed for component creation |
| projects/igniteui-angular/src/lib/time-picker/time-picker.common.ts | Changed token from string to InjectionToken |
| projects/igniteui-angular/src/lib/time-picker/time-picker.component.ts | Migrated to inject() API |
| projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.ts | Removed large constructor, migrated to inject() |
| projects/igniteui-angular/src/lib/services/overlay/overlay.ts | Converted to inject() API |
| projects/igniteui-angular/src/lib/icon/icon.service.ts | Migrated all constructor parameters to inject() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot can you do deep review on the PR and the tests modifieid |
|
@dkamburov I've opened a new pull request, #16453, to work on those changes. Once the pull request is ready, I'll request review from you. |
...s/igniteui-angular/directives/src/directives/scroll-inertia/scroll_inertia.directive.spec.ts
Fixed
Show fixed
Hide fixed
...niteui-angular/directives/src/directives/date-time-editor/date-time-editor.directive.spec.ts
Fixed
Show fixed
Hide fixed
...niteui-angular/directives/src/directives/date-time-editor/date-time-editor.directive.spec.ts
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 274 out of 274 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@IMinchev64 conflicts again :( |
| @@ -1,4 +1,4 @@ | |||
| import { ChangeDetectionStrategy, Component, DebugElement, ViewChild, ElementRef, OnInit } from '@angular/core'; | |||
| import { ChangeDetectionStrategy, Component, DebugElement, ViewChild, ElementRef, OnInit, inject as inject_1 } from '@angular/core'; | |||
There was a problem hiding this comment.
why this is renamed to inject_1?
@IMinchev64 please update these as well.
|

Related to this task
This PR refactors the entire Ignite UI for Angular component library to use the Angular inject() API instead of constructor-based dependency injection.
Additional information (check all that apply):
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)