Hello how can you redirect to another page in Blazor
with a parameter?
@page "/auth"
@using Microsoft.AspNetCore.Blazor.Services;
@inject AuthService auth
@inject IUriHelper urihelper;
<input type="text" bind="@Username" />
<button onclick="@AuthAsync">Authenticate</button>
@functions{
public string Username { get; set; }
public string url = "/home";
public async Task AuthAsync()
{
var ticket=await this.auth.AuthenticateAsync(Username);
urihelper.NavigateTo(url); //i see no overload that accepts parameters
}
}
In this case i want to navigate to the /home
page giving it a string as parameter.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…