Angular 清除过滤器角度6

Angular 清除过滤器角度6,angular,button,filter,angular-material,reset,Angular,Button,Filter,Angular Material,Reset,我有一个带有如下过滤器的表: <form [formGroup]="form" (ngSubmit)="onSubmit()"> <mat-form-field class="filter" floatLabel="never"> <mat-label>Name</mat-label> <input matInput formControlName="nameFilter"> <

我有一个带有如下过滤器的表:

<form  [formGroup]="form"  (ngSubmit)="onSubmit()">
   <mat-form-field class="filter" floatLabel="never">
      <mat-label>Name</mat-label>
         <input matInput formControlName="nameFilter">
      </mat-form-field> 
  <button mat-raised-button class="search">Search</button>
</form>

<button mat-raised-button class="reset" (click)="resetFilter()">Reset</button>

名称
搜寻
重置
我应该在TS中插入什么才能取消筛选?
是否需要在表单中插入“过滤器”按钮?

表单组本身具有重置方法。就叫它吧

<button mat-raised-button class="reset" (click)="form.reset()">Reset</button>
重置

您需要使用角度重置方法,这是默认的形式方法。您需要在单击“重置筛选器”并清除下面的表单组名称时调用此方法

resetFilter() { this.contactForm.reset(); }
使用表单API的reset()

<button mat-raised-button class="reset" (click)="form.controls.nameFilter.reset()">Reset</button>
重置
resetFilter() { this.contactForm.reset(); }
<button mat-raised-button class="reset" (click)="form.controls.nameFilter.reset()">Reset</button>