test(ivy): fixes in the TodoMVC example (#23161)
- properly display initial checked state - properly remove a todo Please note that the 'archive' option still doesn't work correctly as listening to component outputs doesn't seem to work (onArchive() is never called). PR Close #23161
This commit is contained in:
parent
f99cb5c995
commit
32a41bc738
|
@ -33,7 +33,7 @@ export class AppState {
|
|||
// but NgForOf expects creation and binding separate.
|
||||
template: `
|
||||
<div>
|
||||
<input type="checkbox" [value]="todo && todo.done" (click)="onCheckboxClick()">&ngsp;
|
||||
<input type="checkbox" [checked]="todo && todo.done" (change)="onCheckboxClick()">&ngsp;
|
||||
<span [class.done]="todo && todo.done">{{todo && todo.text}}</span>&ngsp;
|
||||
<button (click)="onArchiveClick()">archive</button>
|
||||
</div>
|
||||
|
@ -71,7 +71,7 @@ export class ToDoAppComponent {
|
|||
|
||||
onArchive(item: ToDo) {
|
||||
const todos = this.appState.todos;
|
||||
todos.splice(todos.indexOf(item));
|
||||
todos.splice(todos.indexOf(item), 1);
|
||||
markDirty(this);
|
||||
}
|
||||
}
|
||||
|
@ -108,4 +108,4 @@ export class ToDoAppModule {
|
|||
renderComponent(ToDoAppComponent, {
|
||||
// TODO(misko): This should run without injector.
|
||||
injector: createInjector(ToDoAppModule)
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue