Javascript ';[对象对象],[对象对象]和#x27;对于管道';异步管道&x27;

Javascript ';[对象对象],[对象对象]和#x27;对于管道';异步管道&x27;,javascript,angular,typescript,asynchronous,angular-material,Javascript,Angular,Typescript,Asynchronous,Angular Material,我需要用angular 8中的angular材质创建autocomplete 现在我在ts文件中使用此代码: @Input() admins: User[]; userGroupOptions: Observable<User[]>; filterFormFG: FormGroup; constructor(private utilService: UtilsService, private messageService: MessageService) { t

我需要用angular 8中的angular材质创建autocomplete

现在我在ts文件中使用此代码:

 @Input() admins: User[];
  userGroupOptions: Observable<User[]>;
  filterFormFG: FormGroup;
  constructor(private utilService: UtilsService, private messageService: MessageService) {
    this.createForm();
    this.userGroupOptions = this.filterFormFG.get('createdByRefId').valueChanges
      .pipe(
        startWith(''),
        map(admin => admin ? this._filterStates(admin) : this.admins.slice())
      );
  }

  ngOnInit() {
    // tslint:disable-next-line: no-non-null-assertion


  }

  private _filterStates(value: string): User[] {
    const filterValue = value.toLowerCase();

    return this.admins.filter(state => state.fullname.toLowerCase().indexOf(filterValue) === 0);
  }
@Input()管理员:用户[];
userGroupOptions:可观察;
filterfg:FormGroup;
构造函数(私有utilService:utilService,私有messageService:messageService){
这个.createForm();
this.userGroupOptions=this.filtermefg.get('createdByRefId')。值更改
.烟斗(
startWith(“”),
映射(admin=>admin?this.\u过滤器状态(admin):this.admins.slice()
);
}
恩戈尼尼特(){
//tslint:禁用下一行:无非空断言
}
私有过滤器状态(值:字符串):用户[]{
常量filterValue=value.toLowerCase();
返回此.admins.filter(state=>state.fullname.toLowerCase().indexOf(filterValue)==0);
}
并在html文件中使用:

          <mat-form-field class="example-full-width" appearance="outline">
                        <input matInput [placeholder]="'MESSAGES.SENDER' | translate" aria-label="'MESSAGES.SENDER' | translate" [matAutocomplete]="auto"
                        formControlName="createdByRefId">
                        <mat-autocomplete #auto="matAutocomplete">
                            <mat-option *ngFor="let item of (admins | async)" [value]="item.firstName + ' ' +item.lastName">
                               {{ item.firstName + ' '+ item.lastName | translate }}
                            </mat-option>
                        </mat-autocomplete>
                    </mat-form-field>

{{item.firstName+''+item.lastName | translate}
但它告诉我这个错误:

错误:管道“AsyncPipe”的InvalidPipeArgument:“[object object],[object object]” 在invalidPipeArgumentError时(common.js:4800)

有什么问题吗?如何解决此问题????

管道订阅可观察或承诺,并返回其发出的最新值。当发出新值时,异步管道将标记要检查的组件以进行更改。当组件被销毁时,异步管道会自动取消订阅,以避免潜在的内存泄漏

这里不需要使用异步管道,只需删除它,
admins
只是一个对象数组

<mat-option *ngFor="let item of admins" [value]="item.firstName + ' ' +item.lastName">
  {{ item.firstName + ' '+ item.lastName | translate }}
</mat-option>
<mat-option *ngFor="let item of userGroupOptions | async " 
             [value]="item.firstName + ' ' +item.lastName">
  {{ item.firstName + ' '+ item.lastName | translate }}
</mat-option>