@page "/pokemonsleep"
@inject IPokemonService PokemonService
@attribute [StreamRendering]
Pokemon Sleep
Pokemon Sleep
@if (pokemons == null)
{
Loading...
}
else
{
|
# |
Pokemon |
Sleep Type |
Speciality |
|
@foreach (var pokemon in pokemons)
{
string URL = "https://www.serebii.net/pokemonsleep/pokemon/" + pokemon.Id + ".png";
string ShinyURL = "https://www.serebii.net/pokemonsleep/pokemon/shiny/" + pokemon.Id + ".png";
|
@pokemon.Id |
@pokemon.PokemonName |
@pokemon.SleepType |
@pokemon.Speciality |
|
}
}
@code {
private List pokemons = new List();
protected override async Task OnInitializedAsync()
{
// Simulate asynchronous loading to demonstrate streaming rendering
await Task.Delay(500);
var result = await PokemonService.GetAllPokemonAsync();
if (result is not null)
{
pokemons = result;
}
}
}