-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Heroes tutorial: adding service as described results in JS error #21085
Comments
Did you include the HeroService in your providers-array of the app.module.ts? |
Clarification: It states subtly to import the service:
but never gives the example code on how to do so, which is confusing for beginners and inconsistent whereas most of the tutorial gives explicit example code for any necessary changes. As also mentioned by the OP (separate issue?), the example code given for adding the HeroService to the providers array incorrectly adds MessageService, which isn't written until shortly later in the Create the MessageService section. This breaks the application throwing: error TS2304: Cannot find name 'MessageService'. |
Duplicate of #20398 |
Thank you. It looks like this issue was resolved. Issue #20398 shows the related commits. If this is still an issue, please let us know. Thanks again. |
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. |
I'm submitting a...
Current behavior
While following the Heroes tutorial in chapter 6 (Services), an unexpected JS error is thrown: HeroService is not defined. That happens after "See it run" just before the tutorial moves on to "Observable data".
Expected behavior
No JS error.
Minimal reproduction of the problem with instructions
Follow the tutorial.
What is the motivation / use case for changing the behavior?
Environment
The text was updated successfully, but these errors were encountered: