I just red angular 2 cookbook in how you I can create dynamic forms but I wander how I can add custom validators to particular field.
questions.forEach(question => {
group[question.key] = question.required ? new FormControl(question.value || '', Validators.required)
: new FormControl(question.value || '');
});
Here they form a from group to hold form inputs so what about if I want to apply a particular validation to a particular question
Ex: if I has input for confirming password matching.
I know that there is validateequal attribute to do this task how I can apply this validateequal or even create my own custom validation
Note that it is dynamic form which means could hold any input for example i am planning to use the same form to generate log in form which means that it only has password input , i need away to check if there is input will hold password and if any will hold password confirmation and if so then i need to check if they are matching before submit