We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Whenever I attempt to use hx-vals with a custom razor component, I get the following error:
RZ9986 Component attributes do not support complex content (mixed C# and markup). Attribute: 'hx-vals', text: '{"CurrentCount":CurrentCount}'
Steps to Reproduce:
<button class="inline-flex items-center px-4 py-2 bg-gray-800 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-gray-700 focus:bg-gray-700 active:bg-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition ease-in-out duration-150"> @ChildContent </button> @code { /// <summary> /// The content within this component. /// </summary> [Parameter] public RenderFragment? ChildContent { get; set; } }
<PrimaryButton class="btn btn-primary" hx-put="/counter" hx-vals='{ "CurrentCount": @(CurrentCount) }' hx-target="#counter" @onput="IncrementCount"> Click me </PrimaryButton>
Possible solution: Implement a simple method (maybe an external helper or a method in Htmxor.Components.ConditionalComponentBase) to convert to JSON
Htmxor.Components.ConditionalComponentBase
<PrimaryButton hx-put="/counter" hx-vals=@HtmxHelpers.ToJson(new { CurrentCount} ) hx-target="#counter" @onput="IncrementCount"> Click </PrimaryButton>
public static class HtmxHelpers { public static string ToJson(object value) => JsonSerializer.Serialize(value); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Whenever I attempt to use hx-vals with a custom razor component, I get the following error:
RZ9986 Component attributes do not support complex content (mixed C# and markup). Attribute: 'hx-vals', text: '{"CurrentCount":CurrentCount}'
Steps to Reproduce:
Possible solution:
Implement a simple method (maybe an external helper or a method in
Htmxor.Components.ConditionalComponentBase
) to convert to JSONThe text was updated successfully, but these errors were encountered: