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
EXCEPTION: Error: Uncaught (in promise): TypeError: Cannot read property 'isSkipSelf' of null #8704
Comments
See, dup of #8519 |
Try the following:
|
No change it didn't solved problem. |
Strange, what happens on the console when you add SearchService to the bootstrap: |
Same error. |
Why making AppComponent 'Injectable' when it is root component? Just make your service injectable by enter it into the providers array in your root component "AppComponent". |
Getting the same issue here. I'm working w/ an API and I have separate services for all the API resources, and then one main service that all the separate services consume. My setup is basically: I get this exact error, even if my services are all decorated with I have not had to use Removing API Service and consuming Http directly in the Widget Service works fine. No need to use EDIT - Tried to recreate this issue in the Angular 2 Quickstart Plunkr but was unsuccessful. Seems to work fine there: plnkr One thing I noticed is that I would get the isSkipSelf null error if I tried to inject a nested service w/o first importing the type definition for its class. Adding that import would resolve the isSkipSelf error and give me the helpful "No provider" error message until I added a provider... I'm wondering if this is less about Angular and more about build process or something. @info007 -- what's your build environment? I'm running webpack/awesome-typescript-loader with cheap-module-eval-source-maps. Going to mess around and see if anything sticks... (quick update - swapped source maps and swapped awesome-typescript loader for ts-loader.. same thing..) |
I ended up finding the solution to my problem at least Basically I can't import my service from a barrel, I have to go to the particular file. In other words:
This is with Webpack using CommonJS modules. Not sure what's going on but at least it works. Barrel files are super nice to have though. EDIT - Ok so plot thickens a bit. Its not the barrel file per se, but order matters here. Both my WidgetService and APIService are in the same barrel ('services/index.ts). If I'm going to be importing from the barrel, the imports/exports in that barrel need to be in a particular order. I need to import/export the APIService BEFORE I import/export the WidgetService. This kind of makes sense. If I import the WidgetService from the barrel but it is declared before the ApiService it depends on, you get the cryptic error message. This also explains why
will throw the error
will not throw the error. Other possibilities seem to work too.
TL;DR: Be careful w/ your barrels guys! |
I can confirm the what @ecozoic found out. I ended up having a circular reference to a service because the service I was using imported another service from the same folder, but I used the index.ts barrel to import it. I changed the import statement to reference the actual file and not the barrel and it solved the problem. |
Duplicate of #8519 - we've got a reproduce scenario in the other issue |
I hot a similar error when using angular2 forms - data driven approach. Here it is: " Uncaught (in promise): TypeError: Cannot read property 'setParent' of null " After 3-4 hours of continuous searching and debugging I found out that my form does not have the [formGroup]="myForm" directive on it !! |
@Alon-Gbbe that is not related this issue, but it seems a valid bug. Try the same with latest forms release and reproduce it in a plnkr, when you have that you may want to file an issue. |
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. |
The text was updated successfully, but these errors were encountered: