I am currently creating a to-do list and struggling with saving the CSS strike-through element into local storage.
HTML CODE:
<ul class="list-group">
<li *ngFor="let todo of todos; let i = index"
class="list-group-item shadow p-3 mb-5 bg-white rounded border border-dark rounded" id="myTask">
<input type="checkbox" (click)='update()'><span>
{{todo.task}} <button type="button" class="btn btn-danger" (click)="delete()">X</button>
</span>
</li>
</ul>
Typescript Code:
update() {
localStorage.setItem('checkbox', JSON.stringify(this.todos));
}
CSS Code:
input[type="checkbox"]:checked+span {
text-decoration: line-through;
color: red;
}