Skip to content
Snippets Groups Projects
Commit 8bc6d667 authored by pnogal's avatar pnogal Committed by Paulina Nogal
Browse files

Create an array of formValidators to conditionally pass in maxLength to it when it is set

parent b62bf742
No related branches found
No related tags found
No related merge requests found
......@@ -65,11 +65,13 @@ export class PromptDialogComponent implements OnInit {
ngOnInit() {
// Deafults for input form
let formValidators = [Validators.required];
if (this.maxLength) {
formValidators.push(Validators.maxLength(this.maxLength));
}
this.inputForm = new FormGroup({
value: new FormControl(this.initialValue || '', [
Validators.maxLength(this.maxLength),
Validators.required,
]),
value: new FormControl(this.initialValue || '', formValidators),
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment