Angular 使用ng select的双向绑定问题

Angular 使用ng select的双向绑定问题,angular,Angular,我正在使用ng select插件创建一个多下拉列表。我的场景类似于用户从下拉列表中选择项目。我需要在按钮中填充选中的项目对象,并在下拉列表的正下方添加关闭图标。我可以从两侧删除所选项目,即从下拉列表以及按钮关闭图标中删除所选项目。 我无法使用双向绑定填充列表。对棱角分明的世界来说有点陌生 PFB。请建议操作。通过筛选功能从相册中删除所选对象 @Component({ selector: 'my-app', templateUrl: './app.component.html', st

我正在使用ng select插件创建一个多下拉列表。我的场景类似于用户从下拉列表中选择项目。我需要在按钮中填充选中的项目对象,并在下拉列表的正下方添加关闭图标。我可以从两侧删除所选项目,即从下拉列表以及按钮关闭图标中删除所选项目。 我无法使用双向绑定填充列表。对棱角分明的世界来说有点陌生


PFB。请建议操作。

通过筛选功能从相册中删除所选对象

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  name = 'Angular 5';
  albums = [];
  selectedMember = null;
  selectedTeamMember;
  constructor(http: HttpClient) {
    http.get<any[]>('https://jsonplaceholder.typicode.com/posts').subscribe(albums => {
      this.albums = albums;
    });
  }


  onChange(event) {
    this.selectedTeamMember = event
  }

  removeTeamMember(obj) {
    this.albums = this.albums.filter((item)=> { 
    return item !== obj
  })
  }
}
@组件({
选择器:“我的应用程序”,
templateUrl:“./app.component.html”,
样式URL:['./app.component.css']
})
导出类AppComponent{
名称='5';
专辑=[];
selectedMember=null;
选定的团队成员;
构造函数(http:HttpClient){
http.get('https://jsonplaceholder.typicode.com/posts)。订阅(相册=>{
this.albums=相册;
});
}
onChange(事件){
this.selectedTeamMember=事件
}
移除团队成员(obj){
this.albums=this.albums.filter((项)=>{
返回项目!==obj
})
}
}