hn-20-2/Apps/Client/Shared/CommentForm.razor
2021-04-28 15:03:29 +02:00

22 lines
574 B
Plaintext

<EditForm Model="_model" OnValidSubmit="OnValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<label for="content">Your comment</label>
<InputTextArea id="content" @bind-Value="_model.Content" />
<button type="submit">Post your comment</button>
</EditForm>
@code {
[Parameter]
public EventCallback<PublishCommentCommand> OnSubmit { get; set; }
private PublishCommentCommand _model = new PublishCommentCommand();
private async Task OnValidSubmit()
{
await OnSubmit.InvokeAsync(_model);
_model = new PublishCommentCommand();
}
}