Angular 如何清除“材质自动完成角度”中的所有加载值?

Angular 如何清除“材质自动完成角度”中的所有加载值?,angular,typescript,angular6,form-control,Angular,Typescript,Angular6,Form Control,我试图在选择更改另一个mat select(材料选择)字段时清除材料输入字段中的所有加载值。我只能清除选定的值,不能清除输入字段属性中所有加载的值。这是代码 HTML: <mat-form-field> <mat-select formControlName="searchType" (selectionChange)="searchTypeChange()" placeholder="Search By"> <mat-option *ngF

我试图在选择更改另一个mat select(材料选择)字段时清除材料输入字段中的所有加载值。我只能清除选定的值,不能清除输入字段
属性
中所有加载的值。这是代码

HTML

<mat-form-field>
    <mat-select formControlName="searchType" (selectionChange)="searchTypeChange()" placeholder="Search By">
        <mat-option *ngFor="let st of searchTypes" [value]="st.value">
            {{st.viewValue}}
        </mat-option>
    </mat-select>
</mat-form-field>

<mat-form-field *ngIf="searchForm.get('searchType').value==6" class="example-full-width">
    <input matInput placeholder="PropertyID" [formControl] ="property"    [matAutocomplete]="auto">
    <mat-autocomplete #auto="matAutocomplete" autoActiveFirstOption>
        <mat-option *ngFor="let option of propertyfilteredOptions | async" [value]="option">
            {{option}}
        </mat-option>
    </mat-autocomplete>
</mat-form-field>
ngOnInit(): void {
    this.searchForm=this.fb.group({
       prop:this.property,
    });
}
searchTypeChange(){
    this.searchForm.get('prop').setValue('');
    this.property.reset(); //this is not working
}

您正在尝试重置FormControl。它不向MatSelect提供数据。它从订阅获取数据-
propertyfilteredOptions | async
。您需要将新值传递给
propertyfilteredOptions
Observable

你也可以选择f.ex。只需将其更改为新的可观察对象:

this.propertyfilteredOptions = new Observable([]);