I have a span which should have an onclick attribute if the IsActive bool is true. Otherwise the span should have no onclick attribute.
e.g.
@if (IsActive == true)
{
<span @onclick="@(e => Go.DoSomething("please"))">
@s.DisplayText
</span>
}
else
{
<span>
@s.DisplayText
</span>
}
Is there not a way to avoid the repeated code using a ternary operator? e.g.
@(IsActive == true ? "add onclick method somehow?" : "")