Angular 2 TypeScript how to find element in Array

Source: https://stackoverflow.com/questions/37969984/angular-2-typescript-how-to-find-element-in-array
You need to use method Array.filter:
this.persons =  this.personService.getPersons().filter(x => x.id == this.personId)[0];
this.persons =  this.personService.getPersons().find(x => x.id == this.personId);

Không có nhận xét nào:

StaticImage

  import React , { useEffect , useRef } from "react" import { StaticImage } from "gatsby-plugin-image" impor...