mirror of
https://github.com/PacktPublishing/Web-Development-with-Blazor-Second-Edition.git
synced 2025-12-06 05:32:03 +01:00
23 lines
401 B
Plaintext
23 lines
401 B
Plaintext
@page "/"
|
|
@using Data.Models.Interfaces
|
|
@using Data.Models
|
|
@inject IBlogApi _api
|
|
|
|
<ul>
|
|
@foreach (var p in posts)
|
|
{
|
|
<li>@p.Title</li>
|
|
}
|
|
</ul>
|
|
|
|
|
|
@code {
|
|
protected List<BlogPost> posts = new List<BlogPost>();
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
posts = await _api.GetBlogPostsAsync(10, 0);
|
|
await base.OnInitializedAsync();
|
|
}
|
|
|
|
}
|