我在Angular 4中遇到以下错误:
ERROR TypeError: Cannot read property 'invalid' of undefined
以下是代码:
<form name="form" #f="ngForm" novalidate>
<tr>
<td width="10%" class="text-blue"></td>
<td><input type="text" name="bankname" maxlength="25" appRestrictinput ="words" [(ngModel)]="model.bk_name" #bk_name="ngModel" class="form-control" autofocus /> </td>
</tr>
<div *ngIf="bankname.invalid && (bankname.dirty || bankname.touched)" class="alert alert-danger">
<div *ngIf="bankname.errors.required">Name is required</div>
</div>
</form>
请告诉我哪里做错了,谢谢您的帮助。
bk_name
, and you are usingbankname
- JSON