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
docs: update DI in action to recommend new way of defining providers #23076
Conversation
You can preview 5a0b5e3 at https://pr23076-5a0b5e3.ngbuilds.io/. |
You can preview 4fb820c at https://pr23076-4fb820c.ngbuilds.io/. |
@@ -142,14 +130,6 @@ Notice the `@Injectable()`decorator on the `UserContextService` class. | |||
|
|||
That decorator makes it possible for Angular to identify the types of its two dependencies, `LoggerService` and `UserService`. |
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.
That decorator indicates that the Angular DI system will be used to create one or more instances of
UserContextService
.
But the service would break the moment you gave it a dependency and you'd have to go back | ||
and add `@Injectable()` to fix it. Add `@Injectable()` from the start for the sake | ||
of consistency and to avoid future pain. | ||
|
||
|
||
<div class="alert is-helpful"> |
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.
Delete this alert-is-helpful
, it's factually incorrect. The l-sub-section
following it (about why AppComponent
doesn't need Injectable
) can also go away.
You can preview 88b8f5a at https://pr23076-88b8f5a.ngbuilds.io/. |
You can preview 7385edd at https://pr23076-7385edd.ngbuilds.io/. |
7385edd
to
142084a
Compare
You can preview 142084a at https://pr23076-142084a.ngbuilds.io/. |
@IgorMinar Would you please approve this? It's asking for someone from io-guide-and-tutorial. Alex R and I have approved. Just need to pass pull-approve test now. Thank you! |
@IgorMinar Can you also provide an approval. We need an approval from you or someone else in the guide-and-tutorial group. This PR doesn't touch tutorial files, just ngmodule and DI files, but pull-approve is asking for the guide-and-tutorial group. AlexR has approved. Thanks! |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Does not describe the new way of defining providers
Issue Number: N/A
What is the new behavior?
added doc that describes the new way of defining providers
Does this PR introduce a breaking change?
Other information