Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

*ngFor in Ionic Popover/Modal not working

This code works any where within my pages except for Popover and Modal. I get Can't bind to 'ngForOf' since it isn't a known property of 'div'

Is there any work around to this?

<div *ngFor="let u of users">
  <ion-row>
    <ion-col size="12">
      <ion-label>
        <ion-title>{{ u.first}}</ion-title>
      </ion-label>
    </ion-col>
  </ion-row>
</div>
users: any[] = [
  {
    id: 1,
    first: 'Alice',
    last: 'Smith',
  },
  {
    id: 2,
    first: 'Bob',
    last: 'Davis',
  },
  {
    id: 3,
    first: 'Charlie',
    last: 'Rosenburg',
  }
];
like image 603
Niang Moore Avatar asked Nov 06 '22 06:11

Niang Moore


1 Answers

I have found the answer in this link, Where you should add the Modal component in the root app module: First import the Modal page in your app.module,

import {ModalPage} from "./home/modal.page"

then declares it inside declarations and entryComponents

declarations: [AppComponent,ModalPage],

entryComponents: [ModalPage],
like image 70
dinesh Deva Avatar answered Nov 12 '22 18:11

dinesh Deva