Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
obterFormularioCadastro(): FormGroup {
let senha = new FormControl('', Validators.required);
let confirmacaoSenha = new FormControl('', CustomValidators.equalTo(senha));
return this.formBuilder.group({
nomeCompleto: ['', Validators.required],
cpf: ['', Validators.required],
dataNascimento: ['', Validators.required],
email: ['', Validators.required],
telefone: ['', Validators.required],
senha,
confirmacaoSenha
});
}
_.forEach(validators, (validator: PageControlValidator) => {
if (validator.isActive) {
switch (validator.validatorType) {
case ValidatorType.Required:
formValidators.push(Validators.required)
break
case ValidatorType.Equal:
formValidators.push(CustomValidators.equal(JSON.parse(validator.validatorOption)))
break
case ValidatorType.EqualTo:
const foundEqualToControl = availableControls[validator.validatorOption]
if (!!foundEqualToControl) {
formValidators.push(CustomValidators.equalTo(foundEqualToControl))
}
break
case ValidatorType.Email:
formValidators.push(CustomValidators.email)
break
case ValidatorType.Number:
formValidators.push(CustomValidators.number)
break
case ValidatorType.NumberRange:
formValidators.push(CustomValidators.range(JSON.parse(validator.validatorOption)))
break
case ValidatorType.DateTime:
formValidators.push(CustomValidators.date)
break
case ValidatorType.MinDate:
formValidators.push(CustomValidators.minDate(validator.validatorOption))