-
Notifications
You must be signed in to change notification settings - Fork 4k
No results after implementing ProductService class #119
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
Comments
Update as I was gathering info for this issue! I went into my product.service.ts file to remove the product information (so putting it here would be less bulky) and lo and behold making a comment in the file fixed it. The comment itself didn't fix it obviously, but causing an update in the product.service.ts file must have forced angular to update the reference to the class after fixing the null ref issue. So if you finish with Module 9 and have a similar issue, either restart the app or force an update to the service file and you should be fine. Caching is a wonderful thing... |
Also good to note, you definitely do not need to have a providers line in app.module.ts if the products are now loading, so I'm still very confused, but it works lol |
Glad you were able to resolve the issue. Depending on the browser you are using, it is possible to turn caching off to minimize this issue. Regarding the providers array, you should no longer need that. Services are now registered using the Hope this helps! |
@DeborahK - thanks, that's what I thought. Still not sure why adding it partially fixed the issue. |
Hello,
I've been following along with the tutorial and have just completed Module 9, the section where our product list is separated form the component and initially hard-coded into the service. I've gone through the section a few times now and have not had success in getting the products to show up again.
At first I was having the issue
NullInjectorError: No provider for ProductService!
. I added the ProductService class to the providers of app.module.ts, which seemed to fix that issue, but I don't recall that being necessary from the tutorial, and the provided 'checkpoint' example for Module 9 doesn't have that line.The issue following this, however, does not show any of the products in ProductService. This is also true when I compile directly from the example code from Module 9. No products are listed and no errors appear in the console. I'm not sure what I might be doing wrong?
The text was updated successfully, but these errors were encountered: