I've created a method in my utils.ts to delete an element from an array.
public static deleteElementFromArray<T>(list: T[], element: T): T[] {
if (!list) {
return [];
}
const index = list.indexOf(element);
if (index > -1) {
list.splice(index, 1);
}
return list;
}
a friend of mine tell me that he uses filter
to filter the list and exclude the element.
users = users.filter(u => u !== toto);
I wonder what you think of this and if you have a better solution