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

'component' is not a known element #14

Closed
fknop opened this issue Dec 10, 2016 · 20 comments
Closed

'component' is not a known element #14

fknop opened this issue Dec 10, 2016 · 20 comments
Labels

Comments

@fknop
Copy link

fknop commented Dec 10, 2016

When a custom component is imported via a module, it cannot be found inside a template, it shows:

image

@chuckjaz
Copy link
Contributor

Can you produce a repository that duplicates this?

@fknop
Copy link
Author

fknop commented Dec 12, 2016

I'm not able to reproduce it in a new project, I'll come back to you if I succeed to reproduce it.

@petebacondarwin
Copy link
Member

This may be related to #36?

@chuckjaz
Copy link
Contributor

@petebacondarwin Could be but without a solid repo it is hard to be sure.

@chuckjaz
Copy link
Contributor

Please reopen if you can still reproduce this in 0.1.0

@alejandrocoding
Copy link

I have the same error:

bug

It happens with those component you are importing by their modules, so in my ngModule I import XModule and I use XComponent inside of my new component and it triggers that error as it doesn't recognize that the component is coming from the imported module.

@alejandrocoding
Copy link

version 0.1.2

@chuckjaz
Copy link
Contributor

@ialex90 Can you open a separate issue and attach either a .zip file that reproduces this or a github project I can clone?

@alejandrocoding
Copy link

@chuckjaz I've tried this plugin in 2 different environments with the same result. I think if you import a module and try to use the component, will see the error. Haven't this happened to you in the latest version? It's a very common scenario and I've faced on Windows & MacOS. Do you need me to recreate this scenario?

@chuckjaz
Copy link
Contributor

This is not the same issue as above which is why I would like a new issue open. Second, I always want to be very clear about what issue is being resolved. Having a repro attached to the bug helps with that immensely event if you believe the repro is trivial, please attach one.

Also, note that structural changes (such as importing and modifying a module) take a few seconds to propagate because we are deferring some expensive calculations. Try modifying the source reporting the error a 5 to 10 seconds after you made the @NgModule change.

@alejandrocoding
Copy link

alejandrocoding commented Apr 11, 2017

I have been creating a small project with a single ngmodule exported and imported and it works well with the plugin. I got the update today too, not sure if it's because of that, anyway, in the big project I'm working on, even with the newest version, it does trigger that error that I showed above and I can't replicate a scenario with 30-40 module just to see if triggers the error or not.

I will wait if someone else has the same error or maybe in a near future I won't see those errors and will be able to use the plugin.

@uberspeck
Copy link

I'm seeing this issue in v0.1.3. Everything works for me (compiles/runs etc), but my shared module components are still getting "not known element" errors. I've commented on #36

@rweads0520
Copy link

rweads0520 commented Jul 19, 2018

Having this issue in 0.1.9. Only seems to be affecting library components referenced from outside of the app's project structure, even when both project folders are loaded into vs code. e.g. referencing from "projects/shared-lib/src/public_api" shows no error, referencing from "../ngls-issue-lib/projects/ext-lib/src/public_api" can't resolve the component and shows an error.

The app builds and runs without problems, displays all components.

Reproduced in sample project at public repo:
https://github.com/rweads0520/ngls-issue.git

@RajendrasinhParmar
Copy link

I'm also having a same issue

@htevfik
Copy link

htevfik commented Aug 5, 2018

i'm also having this issue while using a third party module angular2gridster on my ionic4 project.

@jiovanniro
Copy link

jiovanniro commented Aug 13, 2018

Check to see if the component was imported and added to @NgModule declarations in your app.module.ts file. You may have to manually do the following:

  1. Import your component
    import { HomeComponent } from './home/home.component';

  2. add it to the @NgModule declarations
    @NgModule({
    declarations: [
    AppComponent,
    HomeComponent
    ]

@a-eid
Copy link

a-eid commented Oct 7, 2018

I'm still having this issue vscode version 1.27.2 ,
I'd like to note that my app is working fine. and it's not a 3rd party component.

@carlosearaujo
Copy link

Add

schemas: [ CUSTOM_ELEMENTS_SCHEMA ]

on component module

@kuncevic
Copy link

kuncevic commented Jan 24, 2020

Having that on mac Catalaina 10.15.2 with angular material components that I am exporting from the custom angular material module that lives in my shared library in my monorepo

VScode details:
Version: 1.41.1
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:57:51.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 19.2.0

@carlosearaujo

Add

schemas: [ CUSTOM_ELEMENTS_SCHEMA ]

on component module

By adding schemas: [ CUSTOM_ELEMENTS_SCHEMA ] that to my material module didn't fix the problem.

UPDATE:
Seems like there is an issue with language-service #340

@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 Feb 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests