此代码适用于我的页面中除 Popover 和 Modal 之外的任何位置。我得到 Can't bind to '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>
Run Code Online (Sandbox Code Playgroud)
users: any[] = [
{
id: 1,
first: 'Alice',
last: 'Smith',
},
{
id: 2,
first: 'Bob',
last: 'Davis',
},
{
id: 3,
first: 'Charlie',
last: 'Rosenburg',
}
];
Run Code Online (Sandbox Code Playgroud) 我在离子应用程序中使用角度,但在模态中 ngForm 不起作用。我认为只需简单的代码就可以清楚地了解。
<li *ngFor="let item of [1,2,3,4,5]; let i = index">
{{i}} {{item}}
</li>
Run Code Online (Sandbox Code Playgroud)
此代码在页面的所有其余部分中显示了这一点 - >
但在模态中创建像这样
async presentModal(test){
const modal = await this.modalController.create({
component: TestPage,
componentProps: {
test
}
});
modal.onWillDismiss().then(dataReturned => {
});
return await modal.present();
}
Run Code Online (Sandbox Code Playgroud)
不要显示任何东西。有人建议为什么在模态中 *ngFor o 甚至 *ngForm 不起作用?我缺少什么吗?谢谢。
PD:我可以在模态中做我想做的所有事情,就像写“你好”或模态正确显示的内容,但 ngform 不显示任何内容。
PD2:
还有 mu module.ts 以及我尝试导入的所有内容,搜索一些内容来解决这个问题...
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule, NavController } from …Run Code Online (Sandbox Code Playgroud)