How to import Parallel Components in my Angular Project #7
-
Hello, I am trying to import one of the Parallel Components into my Angular Projekt. How could this be solved? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @MikeKronewald, You got the first part right... import { ProgressBar } from @atos-parallel/components/dist/components/progressBar; Since Parallel components are native web components, there is no need to import them in your ngModule. import { CUSTOM_ELEMENTS_SCHEMA } from @angular/core;
import { ProgressBar } from @atos-parallel/components/dist/components/progressBar;
// ...
@ngModule({
declarations: [],
imports: [/* your imports */], // Do not add **Parallel** components here
exports: [/* your exports */],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
}) And that's it. |
Beta Was this translation helpful? Give feedback.
-
Angular does not support a way to add custom schema... It is suggested to wrap each Parallel component into an Angular component and use the See the following post for more details: https://manuel-rauber.com/2021/02/23/youre-using-custom_elements_schema-wrong/ Lit is also working on an extension for its CLI to make it possible to auto generate such wrapper classes. |
Beta Was this translation helpful? Give feedback.
Hi @MikeKronewald,
great question 👍
You got the first part right...
You need to import the module first like you did for the progressBar. E.g.:
Since Parallel components are native web components, there is no need to import them in your ngModule.
You need however to tell Angular, that you are also using native web components, so that it doesn't complain about an unknown element in your template.
To do this, you just need to add
CUSTOM_ELEMENTS_SCHEMA
to each ngModule that uses Parallel components...This would look like this: