Skip to content

Allow one static empty option in a select element with dynamic options #1103

@JosephSilber

Description

@JosephSilber

When the model is null or an empty string, the static option will be selected. For example:

<select v-model="user" options="users | optionify 'name' 'id'">
    <option>Select a user...</option>
</select>

Without this, you have to fiddle around with the users array to add a "Select a user..." option.

Angular has been supporting this for a long time...


BTW, I really think that optionify filter should ship in core...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions