-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Docs: Refactor dependency injection examples with inject() function - Issue 23270 #23275
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
Conversation
Revised the example to use the inject() function for EnvironmentService in Angular, reflecting modern dependency injection practices.
Replaces constructor-based injection with the inject() function in the Angular service usage example. Updates the explanation to reflect this change for improved clarity and alignment with modern Angular practices.
Refactored Angular documentation examples to use the inject() function for dependency injection instead of constructor injection. This aligns the docs with Angular's recommended DI approach and improves code clarity for service and component instantiation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks pretty nice and neat apart from very small points. If we just resolve the comments and these notes, it is ready to be merged
-
We need to change this constructor injection either
docs/en/framework/ui/angular/theming.md
constructor(@Inject(INJECTOR_PIPE_DATA_TOKEN) public data: UserMenu) {}
-
That would be the best if we also update these. Even if they are not listed in the navigation bar, they are still reachable.
-
docs/en/framework/ui/angular/how-replaceable-components-work-with-extensions.md
-
docs/en/framework/ui/angular/http-error-reporter-service.md
-
docs/en/framework/ui/angular/permission-management-component-replacement.md
-
docs/en/modules/setting-management.md
-
docs/en/ui-themes/lepton-x/angular-customization.md
-
the same applies for the
tutorials
folder ::docs/en/tutorials
-
Description
Resolves #23270 (write the related issue number if available)
TODO: This PR updates the Angular documentation to use the modern inject() function for dependency injection instead of constructor-based injection.
Changes include:
This ensures our docs stay up-to-date with the latest Angular DI patterns and help developers adopt the new API more easily.