我刚刚更新到 angular 9!突然我得到了这个例外:
Error occurs in the template of *, error NG8003: No directive found with exportAs 'ngForm'
这是模板:
<form (ngSubmit)="onLogin(frm.value)" #frm="ngForm" style="margin:0 auto;"> //All of these was working fine before the update
Run Code Online (Sandbox Code Playgroud)
我还导入了FormsModule, ReactiveFormsModule, CommonModulein app.module.ts:
imports: [
BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
HttpClientModule,
FormsModule,
ReactiveFormsModule,
CommonModule,
Run Code Online (Sandbox Code Playgroud)
请注意,我使用的是 Visual Studio 角度模板。
谢谢你的帮助。
您必须将ngForm指令添加到表单中:
<form (ngSubmit)="onLogin(frm.value)" ngForm #frm style="margin:0 auto;">
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2431 次 |
| 最近记录: |