Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

select directive should allow user to handle missing option for given model value #10127

Closed
@mdvorak

Description

@mdvorak

Angular 1.3.3, single-value select directive

Today, when model has value that is not in ng-options collection, it inserts either placeholder option or empty option with '?' value. There is however no way to validate this state, since its all stored in private variables and model is considered valid. It is impossible to mark such field visually using css.

Directive should set a flag on ngModel controller to allow validation. All logic is now however in its $render method, and I'm not sure its the right place to do that, althou it would probably work.

When this is done, it would be easy to add custom validator that would check this flag and mark the field as invalid. Such validation directive could be part of core, since its quite common use-case, that non-existent value in select is invalid value.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions