mirror of
https://github.com/LucasVbr/todo-list.git
synced 2026-05-13 17:22:04 +00:00
Edit localStorage changes
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user