Confused by error message regarding attribute syntax
I’ve just started to play around with Blazor and tried to write this code in a .razor-file:
<span class="@if(sortType != 0) { <text>btn-primary</text> } else { <text>btn-success</text> }">
Yes, not very elegant :-) Either way, I got this error message that confuses me:
Code blocks delimited by '@{...}' like '@{ if(sortType != 0) { } }' for attributes are no longer supported These features have been changed to use attribute syntax. Use 'attr="@(x => {... }"'.
I’ve tried to rewrite me code to use lambda expression as suggested, but whatever I do a get an error message. Is this possible in this case? I’ve noticed that a lambda expression works fine if the attribute is @onclick.
If I rewrite my code like this it works, but that is not was the error message suggest:
<span class="btn @(sortType != 0 ? "btn-primary" : "btn-success")">
We've moved this issue to the Backlog milestone. This means that it is not going to happen for the coming release. We will reassess the backlog following the current release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources.
Moving this to .NET 7 planning if and only if this is just a matter of changing the error description. Otherwise, there's limited community engagement for this issue to pursue a more complex solution.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.