Open
Description
I have an InputSelect
component which will be displayed based on a condition. Within the InputSelect component, I'm generating all available options using an @foreach
based on an IEnumerable
.
I would expect the code to be formatted like this:
@if (rule.Element is not null)
{
<InputSelect @bind-Value="rule.ComparisonOperator" id="@($"rule-compare-{rule.GetHashCode()}")" class="form-select" aria-placeholder="Operator">
@foreach (ComparisonOperator item in GetAllowedOperators(rule.Element))
{
<option value="@item">@item</option>
}
</InputSelect>
<label for="@($"rule-compare-{rule.GetHashCode()}")">Operator</label>
}
Instead I get this:
@if (rule.Element is not null)
{
<InputSelect @bind-Value="rule.ComparisonOperator" id="@($"rule-compare-{rule.GetHashCode()}")" class="form-select" aria-placeholder="Operator">
@foreach (ComparisonOperator item in GetAllowedOperators(rule.Element))
{
<option value="@item">@item</option>
}
</InputSelect>
<label for="@($"rule-compare-{rule.GetHashCode()}")">Operator</label>
}
Note all code is also wrapped around by another null check
Activity