angulartypescriptfrontendstorybookangular-storybook

How to use a component inside another one in Storybook, when using Angular


I have this folder structure, in which I have both my button and card components:

enter image description here

I declared a components.module.ts, and placed all my components in there, so I can import it in my app.module.ts, like this:

enter image description here

enter image description here

The problem is that when I try to use the ButtonComponents inside the CardComponent, by its selector ( app-button ), the component is not rendered. Why this happens?

Edit: I have also added the contents of button.component.ts and card.component.html:

enter image description here

enter image description here


Solution

  • My problem wasn't related to Angular, but to Storybook. When you want to be able to display a component in storybook which has dependencies to others, you should specify the module in the decorators property like so.

    enter image description here