Skip to content

Update FormBuilder#control() to support AbstractControlOptions as 2nd parameter #19163

Closed
@Klinton90

Description

@Klinton90

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x ] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request 

Current behavior

In 5.x version AbstractControlOptions has been added as parameter to FormControl constructor. FormBuilder#control() method should create new control by provided configuration. Currently signature/input parameters do not match FormControl.

Expected behavior

control(
     formState: any = null,
      validatorOrOpts?: ValidatorFn|ValidatorFn[]|AbstractControlOptions|null,
      asyncValidator?: AsyncValidatorFn|AsyncValidatorFn[]|null
): FormControl {
    return new FormControl(formState, validatorOrOpts, asyncValidator);
  }

Minimal reproduction of the problem with instructions

this.fb.group({
    "input1": this.fb.control('', {updateOn: 'submit'})
});

What is the motivation / use case for changing the behavior?

Just to keep code consistent

Environment

Angular version: 5.0.0-beta6

Other

It would be nice, if you could also update FormBuilder#group() to support AbstractControlOptions when simple json is provided.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions