[#74950] Angular: Migration to the inject function#23206
Open
myabc wants to merge 1 commit into
Open
Conversation
0470cd5 to
8ac7844
Compare
Migrates Angular constructor-based dependency injection to the
`inject()` function. The initial pass used the Angular schematic;
manual follow-up handled abstract classes, inheritance-sensitive
constructors, and call sites that still instantiate services
directly.
Schematic command:
cd frontend && npx ng generate @angular/core:inject-migration \
--path ./ \
--migrate-abstract-classes \
--backwards-compatible-constructors=false \
--non-nullable-optional=false
https://community.openproject.org/wp/74950
8ac7844 to
e8825ba
Compare
|
Caution The provided work package version does not match the core version Details:
Please make sure that:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket
https://community.openproject.org/wp/74950
What are you trying to accomplish?
Migrate Angular constructor-based dependency injection to the
inject()function across the frontend codebase. This is a mechanical refactoring that removes ~2 200 lines of constructor boilerplate while aligning with the Angular team's recommended DI pattern.What approach did you choose and why?
Used the official Angular schematic as the initial pass:
Manual follow-up was needed for:
GlobalSearchTabsComponent,ViewSettingsModalComponent)ProjectCache,viewerBridgeServiceFactory) that run outside an injection context — kept constructor params or wrapped inrunInInjectionContext()OpAutocompleterServicemoved toprovidedIn: 'root'so subclasses can inherit it without a component-level providerany→unknown,||→??)Merge checklist