Answer the question
In order to leave comments, you need to log in
What is the best way to work with a list in Angular 2(4)?
There is a small application in angular 4. There is a service for working with a specific entity. It stores an array of objects and allows you to add / change / remove elements.
Here is an example of deletion:
deleteItem(itemId) {
this.items.forEach((item, index) => {
if (itemId === item.id) {
this.items.splice(index, 1);
}
});
this.localStorageService.cacheData('items', this.items);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question