0

I'm very new to typescript.

I've got a wrapper component, and a bunch of child components that I want to display.

So, something like this is in my parent component html: <component-card [someData]=someData></component-card> works just fine and displays my component. But how do I display a list of them?

Simply doing <li *ngFor="let card of componentCardArray"></li> doesn't work. I tried different ways

Most tutorials just cover simple types, I searched for hours and can't find a way to do it.

2
  • Are you getting an error? and you will have to show how is your data set up Commented Oct 2, 2019 at 20:06
  • Create a MCVE using StackBlitz to give us some context. Commented Oct 2, 2019 at 20:12

1 Answer 1

1

Okay, I figured it out! I was forgetting to put the selector after the whole *ngFor directive thing. So, here is how my components are displayed now in my wrapper.html:

 <div *ngFor="let card of cardArray">
      <component-card [myData]=myData></component-card>
</div>
Sign up to request clarification or add additional context in comments.

1 Comment

<component-card *ngFor="let card of cardArray" [myData]=card.myData></component-card> Should also be possible..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.