我在离子应用程序中使用角度,但在模态中 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)