Angular 角度自动完成不显示下拉列表?

Angular 角度自动完成不显示下拉列表?,angular,jakarta-ee,autocomplete,mat,Angular,Jakarta Ee,Autocomplete,Mat,我已经创建了多个下拉列表,除了1个字段外,其他一切都正常产品_选项_1,但其余的都有效。我从RESTAPI获取值并将其加载到数组中。在console.log中,它显示产品选项1有valeus,但它没有显示在下拉列表中,尽管相同的逻辑适用于其他下拉列表。请看一下我下面的代码,帮我弄清楚 HTML部分 <mat-card style="margin-top: 10px;" *ngIf="showDetails"> <f

我已经创建了多个下拉列表,除了1个字段外,其他一切都正常产品_选项_1,但其余的都有效。我从RESTAPI获取值并将其加载到数组中。在console.log中,它显示产品选项1有valeus,但它没有显示在下拉列表中,尽管相同的逻辑适用于其他下拉列表。请看一下我下面的代码,帮我弄清楚

HTML部分

<mat-card style="margin-top: 10px;" *ngIf="showDetails">


  
    
  <form [formGroup]="dropDownFormGroup" fxLayout fxLayout.xs="column" fxLayoutGap="10px">
  


  


 <table style="width: 100%;">
                <tr>
                    <td>
    <mat-form-field>
      <mat-label>Product Code</mat-label>
      <input type="text" placeholder="Product Code" matInput [matAutocomplete]="autoProductCode" (change)="modo()" [formControl]="myControl4"  />
      <mat-autocomplete  #autoProductCode="matAutocomplete"  (optionSelected)="OnValueSelected($event.option)"  >
      
        <mat-option  *ngFor="let DROPDOWN_LIST of filter4 | async; index as i"  [value]="DROPDOWN_LIST">
          {{DROPDOWN_LIST}}
        </mat-option>
      </mat-autocomplete>
      </mat-form-field> //working
      </td>
      
<td>
<mat-form-field>
  <mat-label>Product Name</mat-label>
<input type="text" placeholder="product name" matInput [matAutocomplete]="auto" [formControl]="myControl"  />
<mat-autocomplete  #auto="matAutocomplete"  (optionSelected)="OnValue($event.option)">
  
  <mat-option *ngFor="let DROPDOWN_LIST of filteredOptions | async; index as i"  [value]="DROPDOWN_LIST">
    {{DROPDOWN_LIST}}
  </mat-option>
</mat-autocomplete> //working
</mat-form-field>

</td>


<td>

  <mat-form-field>
    <mat-label>Product Option 1</mat-label>
    <input type="text" placeholder="Product Option 1" matInput [matAutocomplete]="autoProductOption" [formControl]="myControl5"  />
    <mat-autocomplete  #autoProductOption="matAutocomplete">
     
      <mat-option *ngFor="let DROPDOWN_LIST of filter5 | async; index as i"  [value]="DROPDOWN_LIST">
        {{DROPDOWN_LIST}}
      </mat-option>
    </mat-autocomplete>
    </mat-form-field>

</td> //not working


 
</tr>
</table>
</form>
</mat-card>


产品代码
{{下拉列表}
//工作
品名
{{下拉列表}
//工作
产品选择1
{{下拉列表}
//不起作用
TS文件


@Component({
  selector: 'lib-config-manager',
  templateUrl: './config-manager.component.html',
  styleUrls: ['./config-manager.component.scss'],
})
export class ConfigManagerComponent implements OnInit {

 DROPDOWN_LIST: templateData[]; 

   templateData:templateData;
  
   filteredOptions:Observable<string[]>;
   myControl=new FormControl();
   myControl1=new FormControl();
   myControl2=new FormControl();
   myControl5=new FormControl();
   
  

   filter1:Observable<string[]>;
   filter2:Observable<string[]>;
   filter3:Observable<string[]>;
  
   filter5:Observable<string[]>;

ngOnInit() {

    

this.filteredOptions=this.myControl.valueChanges.pipe(
  startWith(""),
  map(value=>this._filter(value))
);
this.filter1=this.myControl1.valueChanges.pipe(
  startWith(""),
 map(value=>this.filterAccess(value))
 
  ); //working
 
  this.filter2=this.myControl2.valueChanges.pipe(
    startWith(""),
   map(value=>this.filterSubAccess(value))
   
    ); //working

  
        this.filter5=this.myControl5.valueChanges.pipe(
          startWith(""),
         map(value=>this.filterProductOption1(value))
         
          ); // not workingg
       

  


    this.configManagerService.getTemplateData(0,30).subscribe(
      (templateResponse) =>{
        this.productData= templateResponse.productData;
        this.totalRecords=templateResponse.totalRecords;
        this.startIndex=templateResponse.startIndex;
        this.referenceShowProgressBar



    console.log(this.productData);
        this.DROPDOWN_LIST = templateResponse.productData;
        
     
 
 
  _filter(val: string): string[] {
 
  
   
  return this.DROPDOWN_LIST.map(x => x.product_name).filter(option =>
    option.toLowerCase().includes(val.toLowerCase()));
}

filterAccess(val:string):string[]{
  
  return this.DROPDOWN_LIST.map(x => x.access_type).filter(option =>
    option.toLowerCase().includes(val.toLowerCase()));
}


filterProductCode(val:string):string[]{
  return this.DROPDOWN_LIST.map(x => x.product_code).filter(option =>
    option.toLowerCase().includes(val.toLowerCase()));
  

}


filterProductOption1(val:string):string[]{
  return this.DROPDOWN_LIST.map(x => x.product_option_1).filter(option =>
    option.toLowerCase().includes(val.toLowerCase()));
  
}

}

export class templateData{
  id:number;
  product_code?:string;
  product_name?: string;
  access_type?:string;
 
  product_option_1?:string;
 

@组成部分({
选择器:“库配置管理器”,
templateUrl:“./config manager.component.html”,
样式URL:['./config manager.component.scss'],
})
导出类ConfigManagerComponent实现OnInit{
下拉列表:templateData[];
templateData:templateData;
过滤装置:可观察;
myControl=newformcontrol();
myControl1=新表单控件();
myControl2=新表单控件();
myControl5=新表单控件();
过滤器1:可观察;
过滤器2:可观察;
过滤器3:可观察;
过滤器5:可观察;
恩戈尼尼特(){
this.filteredOptions=this.myControl.valueChanges.pipe(
startWith(“”),
映射(值=>this.\u过滤器(值))
);
this.filter1=this.myControl1.valueChanges.pipe(
startWith(“”),
映射(值=>this.filterAccess(值))
);//工作
this.filter2=this.myControl2.valueChanges.pipe(
startWith(“”),
映射(值=>this.filterSubAccess(值))
);//工作
this.filter5=this.myControl5.valueChanges.pipe(
startWith(“”),
映射(值=>this.filterProductOption1(值))
);//不工作
this.configManagerService.getTemplateData(0,30).subscribe(
(templateResponse)=>{
this.productData=templateResponse.productData;
this.totalRecords=templaterResponse.totalRecords;
this.startIndex=templaterresponse.startIndex;
此.referenceShowProgressBar
console.log(this.productData);
this.DROPDOWN_LIST=templateResponse.productData;
_筛选器(val:string):字符串[]{
返回此.DROPDOWN_LIST.map(x=>x.product_name).filter(选项=>
option.toLowerCase().includes(val.toLowerCase());
}
filterAccess(val:string):字符串[]{
返回此.DROPDOWN\u LIST.map(x=>x.access\u type).filter(选项=>
option.toLowerCase().includes(val.toLowerCase());
}
filterProductCode(val:string):字符串[]{
返回此.DROPDOWN_LIST.map(x=>x.product_code).filter(选项=>
option.toLowerCase().includes(val.toLowerCase());
}
filterProductOption1(val:string):string[]{
返回此.DROPDOWN\u LIST.map(x=>x.product\u选项\u 1).filter(选项=>
option.toLowerCase().includes(val.toLowerCase());
}
}
导出类模板数据{
id:编号;
产品编码?:字符串;
产品名称?:字符串;
访问类型?:字符串;
产品选项1?:字符串;