<ul class="todo-list">
<li *ngFor="let todo of todos" [ngClass]="{completed: todo.isDone, editing: todo.editing}" >
<div class="view">
<input class="toggle"
type="checkbox"
[checked]="todo.isDone"
(click)="toggleTodo(todo)">
<label (dblclick)="todo.editing = true">{{todo.title}}</label>
<button class="destroy" (click)="destroyTodo(todo)"></button>
</div>
<input class="edit"
#updatedTodo
[value]="todo.title"
(blur)="updateTodo(todo, updatedTodo.value)"
(keyup.escape)="todo.editing = false"
(keyup.enter)="updateTodo(todo, updatedTodo.value)">
</li>
</ul>
https://github.com/amejiarosario/angular-todo-app/blob/master/src/app/todo/todo.component.html
I modified the code from this repository and one thing I noticed is that the editing property is not found in the original todos array objects, and is being created inside the html component or maybe elsewhere, I am thinking it's being instantiated in the event listeners, but is it a good idea to do that? I had trouble with it, so I had to instantiate it inside the todos.
Also, instantiating it here in the event listeners means we can't modify the property editing inside the service component, right?
undefined. In TypeScript objects need to have the typeanyfor you to access any property without errors, e.glet TODOS: any[] = [ ]