Angular 5表格数据发布

时间:2018-04-03 13:07:34

标签: angular5 angular4-forms angular-httpclient

当我尝试提交角形式时,我无法读取属性值错误 控制台屏幕错误: 错误类型错误:无法读取属性'值'未定义的 HTML

 <div class="panel-body">
          <form [formGroup]="angForm" novalidate>
            <div class="form-group">
              <label class="col-md-4">Coin Name</label>
              <input type="text" class="form-control" formControlName="name" #name />
            </div>
            <div *ngIf="angForm.controls['name'].invalid && (angForm.controls['name'].dirty || angForm.controls['name'].touched)" class="alert alert-danger">
              <div *ngIf="angForm.controls['name'].errors.required">
                Name is required.
              </div>
            </div>
            <div class="form-group">
              <label class="col-md-4">Coin Price</label>
              <input type="text" class="form-control" formControlName="language" #price/>
            </div>
            <div *ngIf="angForm.controls['language'].invalid && (angForm.controls['language'].dirty || angForm.controls['language'].touched)" class="alert alert-danger">
              <div *ngIf="angForm.controls['language'].errors.required">
                Price is required.
              </div>
            </div>
              <div class="form-group">
                <button (click)="addBooks(name.value, language.value)" [disabled]="angForm.pristine || angForm.invalid" class="btn btn-primary">Add</button>
              </div>
          </form>
        </div>

0 个答案:

没有答案