WizMik
WizMik

Reputation: 17

How to access an exported Angular library component into my application?

I created an Angular library called my-library which has an exported module called DummyModule. This module has an exported DummyComponent and is exposed from my-library through the file public-api.ts like so :

export * from './lib/dummy/dummy.module';

If I import my DummyModule into my AppModule, I can successfully use my DummyComponent into my app.component.html template. So far so good!

But for a some reason that I'm not aware of, if I try to import my DummyComponent inside my app.component.ts file and try to use it in the code, I get the following compilation error:

"export 'DummyComponent' was not found in 'my-library'

How can I access my exported library component into my application and reference it in the components code?

Upvotes: 0

Views: 787

Answers (1)

Rafael Duarte
Rafael Duarte

Reputation: 569

Export the DummyComponent explicitly in your public-api.ts file:

export { DummyComponent } from './lib/dummy/components/dummy/dummy.component';

Upvotes: 2

Related Questions