@page "/articles"
@inject IArticleService ArticleService
Articles
Articles
@if(articles.Count == 0)
{
Loading...
}
else
{
@foreach(var article in articles)
{
@article.Title
@article.Content
@article.DatePublished
}
}
@code {
private List articles = new List();
protected override void OnInitialized()
{
var result = ArticleService.GetAllArticles();
if (result is not null)
{
articles = result;
}
}
}