-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
DoneThis issue has been fixedThis issue has been fixedNeeds: DesignThis issue requires design work before implementating.This issue requires design work before implementating.affected-fewThis issue impacts only small number of customersThis issue impacts only small number of customersarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-builtin-componentsFeatures related to the built in components we ship or could ship in the futureFeatures related to the built in components we ship or could ship in the futureseverity-majorThis label is used by an internal toolThis label is used by an internal tool
Milestone
Description
I would like blazor to provide better management and handler for querystring of current page url
[FromQuery] attribute for two way binding
It should allow binding to a field and/or property, so that it would always binded with query string with the same name as the property
@code {
[FromQuery]
int size = 0;
[FromQuery("queryName")]
int internalName = 0;
[FromQuery("date","yyyyMMddHHmmss")] // with format?
DateTimeOffset internalName = DateTimeOffset.Now;
}
NavigationManager
Should provide API for URI manipulation and history
public static Uri WithQuery(this Uri uri,string name,string value)
{
// anything better with the same result?
var query = HttpUtility.ParseQueryString(uri.Query);
query[name] = value;
return new UriBuilder(uri){ Query = query.ToString() }.Uri;
}
void GetAbsoluteUri(this NavigationManager manager) => manager.ToAbsoluteUri(manager.Uri);
// navigateTo(uri.WithQuery())
void SetQuery(this NavigationManager manager,string name,object value);
void SetQuery(this NavigationManager manager,params (string name,object value)[] values);
string GetQuery(this NavigationManager manager,string name);
/////////
// localhost/?q=0 >>> localhost/?q=1
navManager.SetQuery("q",1);
navManager.SetQuery("q",int.Parse(navManager.GetQuery("q")) + 1);
Underlyingly should just call history.pushState
if available
schotime, aayjaychan, patrickhacens, TomGathercole, Niputi and 10 more
Metadata
Metadata
Assignees
Labels
DoneThis issue has been fixedThis issue has been fixedNeeds: DesignThis issue requires design work before implementating.This issue requires design work before implementating.affected-fewThis issue impacts only small number of customersThis issue impacts only small number of customersarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-builtin-componentsFeatures related to the built in components we ship or could ship in the futureFeatures related to the built in components we ship or could ship in the futureseverity-majorThis label is used by an internal toolThis label is used by an internal tool