Angular 6-验证元素未显示(ng-dirty,ng-invalid ...)

时间:2018-09-02 13:10:33

标签: angular forms

诸如ng-dirty, ngvalid之类的元素未在我的Angular项目中生成, 我要附加下面使用的图像和代码。

enter image description here enter image description here

app.module.ts并在此处输入html

app.module.ts

import { FormsModule,ReactiveFormsModule } from '@angular/forms';

imports: [
     FormsModule,
     ReactiveFormsModule,]
......

Login.html

<form (ngSubmit)="onSubmit()" #demoForm="ngForm">
          <div class="clearfix simple-bar">
      <div class="bar-1"></div>
      <div class="bar-2"></div>
    </div>
      <div class="login-inputs">
        <div class="username-block">
          <div class="icon-block">
              <i class="material-icons">
                email
              </i>
          </div>
          <input type="text"  [(ngModel)]="hero.name" #name="ngModel" name="test" placeholder="Username">
        </div>

........
可能是什么问题?

0 个答案:

没有答案