What is the method to remove an object from a list of objects using an id number in Angular 6 with TypeScript?
EntityService.ts
import { Injectable } from '@angular/core';
import { Entity } from '../../models/entity';
@Injectable({
providedIn: 'root'
})
export class EntityService {
entities: Entity[] = [
{
id: 1,
name: 'Entity 1'
},
{
id: 2,
name: 'Entity 2'
},
{
id: 3,
name: 'Entity 3'
}
];
constructor() { }
deleteEntity(id: number) {
// ???
}
}