add remove method to entities service
This commit is contained in:
parent
a9cddbf19b
commit
ab4568eb9d
@ -96,6 +96,14 @@ export class EntitiesService<E extends IListable, I = E> extends GenericService<
|
||||
}
|
||||
}
|
||||
|
||||
remove(id: string) {
|
||||
const entity = this.all.find(item => item.id === id);
|
||||
if (entity) {
|
||||
this._all$.next(this.all.filter(item => item.id !== id));
|
||||
this._entityDeleted$.next(entity);
|
||||
}
|
||||
}
|
||||
|
||||
find(id: string): E | undefined {
|
||||
return this.all.find(entity => entity.id === id);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user