更新时间:2022-11-13 22:37:51
您需要使用方法
You need to use method Array.filter:
Array.filter
this.persons = this.personService.getPersons().filter(x => x.id == this.personId)[0];
或 Array.find
Array.find
this.persons = this.personService.getPersons().find(x => x.id == this.personId);
Rails:如何使用范围在数组数组中查找元素
Angular 2 TypeScript如何在数组中查找元素
Angular 2 - 在数组中查找实例
Angular 2 TypeScript 如何在数组中查找元素