One select shows its textContent, another nearly identical select does not


Hi.

I'm working on some AngularJS 1.5.8 code.

I'm finding that in the many variations on this theme I've tried:

<li>
    <select ng-disabled="vm.targetPipelines.length == 0"
        class="css-label css-input text-center build-sidebar-btn"
        ng-model="vm.targetPipeline"
        ng-options="pipeline as pipeline.name for pipeline in vm.targetPipelines"
        ng-change="vm.LoadProductVariants()"
        name="name"
        required>
        <option value="">Select a Pipeline</option>
    </select>
</li>

<li>
    <select ng-disabled="vm.targetVariants.length == 0"
        class="css-label css-input text-center build-sidebar-btn"
        ng-model="vm.targetVariant"
        ng-options="variant as variant.name for variant in vm.targetVariants"
        name="variantname"
        required>
        <option value="">Select a Variant</option>
    </select>
</li>

...the first, pipeline-related select box initially says "Select a Pipeline".  But the second, variant-related select box does NOT initially say "Select a Variant".  I want them both to have their "Select a ..." text initially, and can't seem to get the second to have it, even though the first works fine.

Instead of saying "Select a Variant", it consistently has one of two things, depending on which of the many behind-the-scenes incantations I've tried.  It's always either totally empty, or it has the first (and currently only) option preselected.  I don't want either of those behaviors.

Any suggestions?

Thanks for reading, and hopefully, answering!




2 Replies

DS Dan Stromberg August 27, 2024 10:31 PM UTC

Never mind.  It turned out to be a foible of what my Javascript was passing to the HTML.

It was probably that vm.targetVariants was coming up empty.




SS Shereen Shajahan Syncfusion Team August 28, 2024 11:22 AM UTC

Hi Dan,

Thank you for the update. Please get back to us for assistance in the future.

Regards,

Shereen


Loader.
Up arrow icon