Hi,
I’m using the formbuilder with multiple fields where some fields are initially required and some not.
What I struggle is, changing a field to not be required anymore, after some other field in the form has selected a specific value.
For example I got the following form:
this.form = this.formBuilder.group({
name: ['', Validators.required],
type: ['', Validators.required],
year: ['', Validators.required],
place: ['']
});
If the user selects value “b” for the field “type”, the field “year” should not have the “Validators.required” option anymore.
Is it possible to do this somehow?
I already searched on google and here, but couldn’t find any good answer.