Here is the formcontrol I am using. If the user enters Country US i need to set the validator as shown below (min length 5 max length 12)
lblzip1 = new FormControl('', Validators.compose([
Validators.required,
this.noWhitespaceValidator,
Validators.pattern('^[a-zA-Z0-9- ]{5,15}$')
]));
IF the user enters any other country other than US I need to set the validator as shown below (min length 1, mx length 15)
lblzip1 = new FormControl('', Validators.compose([
Validators.required,
this.noWhitespaceValidator,
Validators.pattern('^[a-zA-Z0-9- ]{1,15}$')
]));
Can you please let me know how do we do this in angular?