How can I use ngfor in custom component


#1

I am trying to do a custom component like this and I want use the ngfor data to show information. This is my code:

my component:

import { Component, Input } from '@angular/core';
@Component({
  selector: 'content-info',
  templateUrl: 'content-info.html'
})
export class contentInfo {
  @Input() content: any;
  constructor() {}
}

<div class="container-content" *ngFor="let c of content">
  <div class="name" *ngIf="content.name">
    <div>{{content.name}}</div>
  </div>
  <div class="details">
    {{content.details}}
  </div>
</div>

then in the page i have this

<content-info [content]="datalist"></content-info>

but it shows nothing


#2

Is your component properly declared in your app module?


#3

yes, but I don’t know if I have to do something with the input content in the component?