Edit localStorage changes

This commit is contained in:
Lucàs
2022-07-28 20:16:05 +02:00
parent 8f29701973
commit b82d5445c2
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
</div>
<div class="columns" *ngFor="let item of list">
<input type="checkbox" [(ngModel)]="item.checked" name="{{ item.text }}" id="{{ item.text }}">
<input type="checkbox" [(ngModel)]="item.checked" (ngModelChange)="saveList()" name="{{ item.text }}" id="{{ item.text }}">
<label class="checkbox pl-2" for="{{ item.text }}">
{{ item.text }}
</label>
+5 -5
View File
@@ -28,7 +28,7 @@ export class AppComponent implements OnInit {
if (this.inputValue && !listOfTodoText.includes(this.inputValue)) {
this.list.push(new TodoItem(this.inputValue))
this.inputValue = "";
this.saveList();
this.saveList()
}
}
@@ -38,7 +38,7 @@ export class AppComponent implements OnInit {
*/
removeItem(toRemove: TodoItem): void {
this.list = this.list.filter(item => item !== toRemove);
this.saveList();
this.saveList()
}
/**
@@ -46,11 +46,11 @@ export class AppComponent implements OnInit {
*/
removeCheckedItems(): void {
this.list = this.list.filter(item => !item.checked)
this.saveList();
this.saveList()
}
private saveList(): void {
saveList(): void {
LocalService.saveData(this.LOCAL_STORAGE_KEY, this.list);
console.log(this.list)
}
}