Blazor automatic arbitrary attribute binding ... Is it a thing? #25490
-
@javiercn ... This can be addressed later, after RC1 lands. I've temporarily pulled my errant content+example from the doc, so there's no rush on resolving this. I'll ping u back later this month if this isn't clarified by someone before then. Is automatic arbitrary attribute binding a thing?I searched and didn't quite find a matching issue, although #24916 has similar aspects. I'm working on a doc update, and any of the following are possible:
NOTE ... For the following examples, I understand that I can accomplish the behaviors that I expect by assigning fields/properties directly to attributes ... <input data-info="@val" @bind="val" @bind:event="oninput" /> ... but that's not what I'm asking about. I'm asking about automatic Blazor binding behavior for arbitrary attributes, if any such behavior exists ... <input @bind-data-info="val" @bind-data-info:event="oninput" /> Consider this example for an arbitrary <input @bind="val" />
<input @bind-data-info="val" @bind-data-info:event="oninput" />
<p>
val: @val
</p>
@code {
private string val = "1";
} Load behaviorThe value of Behavior of the first inputChange the first The value of Behavior of the second inputType a value into the second The value of ConclusionThese behaviors seem to indicate that ... That's not a thing. You just made that up. — David Fowler, 2016 Can someone ...
After I hear back, I'll be able to update the Binding doc with the correct guidance on dotnet/AspNetCore.Docs#19721. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@mkArtakMSFT ... I didn't want to make too much noise about this given that it seems much less important than the .NET 5 work. Should this be left here ... or moved to the engineering repo ... or just closed†? There was doc content pertaining to this "feature†" that I've had to pull until we find out if and how this works. †I say "closed" and "feature" because I may have totally made this up. 🙈 I may have misinterpreted some engineering remarks. The content was approved, but it was buried in a whole bunch of other changes, thus it may have slipped in accidentally. Anyway, I pulled the content; so if I did make this up, we don't need to make doc changes. I would only need to close my docs issue, and you can mark this discussion as "answered." UPDATE: I've asked if Steve will put an 👁️ on this just to confirm that I made this up! If I did, we don't need to take further action. I've already pulled the content. All I need to do is close the original issue as fixed. |
Beta Was this translation helpful? Give feedback.
-
About this: <input @bind-data-info="val" @bind-data-info:event="oninput" /> Yep, there's no such feature, and never has been 😄 People should indeed use the actual binding feature that does exist, and can independently render data onto any attribute, like in your other example: <input data-info="@val" @bind="val" @bind:event="oninput" /> |
Beta Was this translation helpful? Give feedback.
About this:
Yep, there's no such feature, and never has been 😄 People should indeed use the actual binding feature that does exist, and can independently render data onto any attribute, like in your other example: