This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@page "/lista-de-tarefas" | |
<h1>Lista de tarefas</h1> | |
<ul> | |
@foreach(var tarefa in tarefas) | |
{ | |
<li>@tarefa.Titulo</li> | |
} | |
</ul> | |
<input placeholder="Alguma coisa para fazer..." @bind(novaTarefa) /> | |
<button @onclick(AdicionarTarefa)>Adicionar tarefa</button> | |
@functions { | |
IList<TarefaModel> tarefas = new List<TarefaModel>(); | |
string novaTarefa; | |
void AdicionarTarefa() | |
{ | |
if(!string.IsNullOrWhiteSpace(novaTarefa)) | |
{ | |
tarefas.Add(new TarefaModel { Titulo = novaTarefa }); | |
novaTarefa = string.Empty; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment