Component is not includd in a module and will not be available inside a template
I am running an Angular 6.03 project in WebStorm 2018.1.4. A number of my component files have a red squiggly line and when I open them up and navigate to them, I see the error:
ng: Component xxx is not included in a module and will not be available inside a template. Consider adding it to a NgModule declaration.
This is really distracting because at any given time, a number of my components have this error. If I erase the 't' at the end of the @Component decorator, wait a second, and then type it back - the error goes away.
I tried other things I found on the Internet, namely setting Settings | Languages & Frameworks | Typescript | TypeScript Language Service - Recompile on Changes to true. I also set the compileOnSave attribute in my tsconfig to true. Neither resolves it.
Can you provide some guidance?
Thanks,
Andrew
Please sign in to leave a comment.
Error comes from Angular language service (https://github.com/angular/angular/issues/14961). You can disable it by clearing Angular language service checkbox in Settings | Languages & Frameworks | Typescript
Ok...thanks... but what am I giving up when I do that? I read up on the Angular Language Service here:
https://angular.io/guide/language-service
According to this, I should lose all Intellisense in my component templates - but I'm not losing it. I'm assuming WebStorm helping out here? What should I be aware of when I turn this off?
Angular intellisense in component templates is provided by WebStorm itself; Angular language service is used for additional linting only (not all Angular template problems reported by service are found by Webstorm static code analysis)
Not sure why this is being handled so dismissively. This is an issue that I am also encountering with an Ionic v4 + Angular v6 project and have not seen this before even though In was using Angular 6 and Typescript just fine before now. Moreover, I am seeing this in IntelliJ IDEA and expect a lot more from a premium IDE than to be throwing bogus errors and providing annoyances in my development environment. Giving up any degree of linting is simply not a solution that seems acceptable to me, since I use linting extensively and find it useful in proactive debugging
it's an issue with a third-party service that can't be fixed on the IDE end
This comment is a bit late, but for the record it happens in VS Code as well so def not a JB error.