Here is a piece of code that works for me:
this.BridgeForm = this.formBuilder.group({
gateway: ["", [Validators.required, Validators.pattern(this.ipRegex)]],
});
However, I would like to provide more detail about the properties:
this.BridgeForm = this.formBuilder.group({
gateway: {
value: "", disabled: false,
Validators: [
Validators.required,
Validators.pattern(this.ipRegex),
]
},
});
Unfortunately, whenever I try the latter version, I encounter an error in my console:
ERROR Error: The MaskedTextBox component supports only string values.
The problem seems to be related to the validators property. I am unable to understand how it should be used based on the information provided in the official documentation.