I'm new to Angular and find it quite tricky with this validation concept. But I have been looking around the internet and I can't seem to find the answer for my problem. Although there is a lot of good tips and guides about validation for Angular.
So my problem is that I have an dropdown menu with 6 options which user can select. After a user has selected one option I want an input field to change validation. For an example:
If the user select option 1 in the drop down. I want the input field to have the validation required and maximum length 5 tokens.
If the user select option 2 in the drop down. I want the input field to have the validation required and maximum length of 10 tokens.
If the user chose option 6 in the drop down. I want the input field to be disabled with no validation. (If the use chose this option then the validation formgroup should be valid)
Any ideas would be greatly appreciated.
The answer in Angular dropdown validation does not cover changing validation on the input element.