[Fixed] Creating a list of checkboxes with ngFor Angular


I have a list of objects that’s structured like this:


I’m trying to create a list of checkboxes with angular out of this list like this:

     <input *ngFor="let object of objects" type="checkbox"> {{object.name}}

The checkboxes themselves do show up, but I can’t get the name of the object to show with each checkbox. What am I doing wrong?


You need to put *ngFor on a container to make the range variable be visible inside it. Here I have used div, but you can use anything you want.

   <div *ngFor="let object of objects">
      <input type="checkbox"> {{object.name}}

Leave a Reply

(*) Required, Your email will not be published