Skip to content

oneOf validator for polymorphic data #91

Closed
@maxime1992

Description

@maxime1992

When dealing with polymorphic data and using the remap functions it'd be nice to have a oneOf validator. It'd take as argument keys of the formGroup so it'd also be type safe.

Example here https://github.com/cloudnc/ngx-sub-form/blob/6ecdb2017e/src/app/main/listing/listing-form/vehicle-listing/vehicle-product.component.ts#L24-L25

And it could look like the following:

public getFormGroupControlOptions(): FormGroupOptions<YourPolymorphicForm> {
  return {
    validators: [NgxSubFormValidators.OneOf('prop1', 'prop2', 'prop3')],
  };
}

Metadata

Metadata

Assignees

Labels

effort-2: hoursWill only take a few hours to fix/createscope: libAnything related to the library itselfstate: has PRA PR is available for that issuetype: featureThis is a new feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions