30 lines
806 B
Plaintext
30 lines
806 B
Plaintext
@page "/todo"
|
|
<h3>Accounts</h3>
|
|
<input @bind="newTodoItem" type = "Enter Item">
|
|
<button @onclick="Save"> Save </button>
|
|
@if (todoList.Count > 0)
|
|
{
|
|
<ul style="list-style: none">
|
|
@foreach (TodoItem todo in todoList)
|
|
{
|
|
<li>
|
|
<input type="checkbox" @bind="todo.IsComplete" />
|
|
<span style = "@(todo.IsComplete ? "text-decoration: line-through" : "")">@todo.Title</span>
|
|
</li>
|
|
}
|
|
</ul>
|
|
}
|
|
|
|
@code {
|
|
private List<TodoItem> todoList = new List<TodoItem>();
|
|
private string newTodoItem { get; set; }
|
|
private void Save()
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(newTodoItem))
|
|
{
|
|
todoList.Add(new TodoItem(newTodoItem));
|
|
newTodoItem = string.Empty;
|
|
}
|
|
}
|
|
}
|