Answers for "remove array of object using id"

3

angular remove object from array by id

//Remove an object from an array by ID (or by other parameter)
person: Person = { id: 2, name: 'Maria' };
listOfPersons = [
  { id: 1, name: 'Jonas' },
  { id: 2, name: 'Maria' }
];

removePerson(person: Person): void {
  this.listOfPersons = this.listOfPersons.filter(({ id }) => id !== person.id);        
}
Posted by: Guest on August-19-2021
0

remove object id from the specific id

// remove ObjectId() that srownd the specific mongoDB object id
// by
_id.toString()
// or
_id.valueOf()
Posted by: Guest on October-16-2021

Code answers related to "remove array of object using id"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language