如何重置角度形式

时间:2019-05-07 06:23:03

标签: angular

如果您在填写表单时中途改变了主意,然后关闭弹出窗口,然后重新打开-它会记住上次输入的值。取消后应清除所有值,如下所示:

<form #propertyInfoForm="ngForm" name="propertyInfoForm" method="POST">
<div class="row client-info mat-client-info mid-box mat-space">
    <div class="col-6">
        <mat-form-field>
           <label class="mat-field-label">Street Address <span class="required-sign">*</span></label>
           <input required matInput [(ngModel)]="valuationObj.propertyAddress" name="propertyAddress" #propertyAddress="ngModel">
           <div *ngIf="propertyAddress.errors && (propertyAddress.dirty || propertyAddress.touched)" class="form-control-error" data-error-list="">
              <ul [hidden]="!propertyAddress.errors.required">
                <li>Street Address is required!</li> 
              </ul>
            </div>
        </mat-form-field>
     </div>
</div>

0 个答案:

没有答案