Skip to content
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

Closed

Conversation

sreevani-ship-it
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[x] Documentation content changes
[ ] angular.io application / infrastructure changes
[ ] Other... Please describe:

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?

[ ] Yes
[x] No

Other information

@mary-poppins
Copy link

You can preview 5a0b5e3 at https://pr23076-5a0b5e3.ngbuilds.io/.

@sreevani-ship-it sreevani-ship-it changed the title docs: update contents to recommend new way of defining providers docs: update DI in action to recommend new way of defining providers Mar 30, 2018
@mary-poppins
Copy link

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`.
Copy link
Member

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">
Copy link
Member

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.

@mary-poppins
Copy link

You can preview 88b8f5a at https://pr23076-88b8f5a.ngbuilds.io/.

@jenniferfell jenniferfell added this to the v6-candidates milestone Mar 30, 2018
@ngbot ngbot bot removed this from the v6-candidates milestone Mar 30, 2018
@jenniferfell jenniferfell added comp: docs target: major This PR is targeted for the next major release labels Mar 30, 2018
@mary-poppins
Copy link

You can preview 7385edd at https://pr23076-7385edd.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 142084a at https://pr23076-142084a.ngbuilds.io/.

@jenniferfell
Copy link
Contributor

@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!

@jenniferfell
Copy link
Contributor

@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!

@IgorMinar IgorMinar added the action: merge The PR is ready for merge by the caretaker label Apr 3, 2018
@alxhub alxhub closed this in 4506230 Apr 3, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants