除了 Popover 和 Modal 之外,此代码适用于我页面中的任何位置。我无法绑定(bind)到“ngForOf”,因为它不是“div”的已知属性
有什么解决方法吗?
<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',
}
];
最佳答案
我在这个 link 中找到了答案,你应该在根 app 模块中添加 Modal 组件:首先在你的 app.module 中导入 Modal 页面,
import {ModalPage} from "./home/modal.page"
然后在声明和 entryComponents 中声明它declarations: [AppComponent,ModalPage],
entryComponents: [ModalPage],
关于javascript - *ngFor 在 Ionic Popover/Modal 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62807086/