Skip to content

Instantly share code, notes, and snippets.

@Bilkiss
Last active December 4, 2020 06:57
Show Gist options
  • Save Bilkiss/57d04051fd81a9e696f274429423d958 to your computer and use it in GitHub Desktop.
Save Bilkiss/57d04051fd81a9e696f274429423d958 to your computer and use it in GitHub Desktop.
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators} from "@angular/forms";
@Component({
selector: 'app-cv',
templateUrl: './cv.component.html',
styleUrls: ['./cv.component.scss']
})
export class CvComponent implements OnInit {
cvForm: FormGroup;
constructor(
public fBuilder: FormBuilder
) { }
ngOnInit(): void {
this.cvForm = this.fBuilder.group({
email: ['', Validators.required],
password: ['', Validators.required],
confirm_password: [''],
rating: [0, Validators.required],
skill_name: ['', Validators.required]
}, { validators: this.checkPasswords });
}
checkPasswords(group: FormGroup){
let pass = group.get('password').value;
let confirmPass = group.get('confirm_password').value;
return pass === confirmPass ? null : { notSame : true }
}
createCv(){
console.log('this.cvForm.value: ', this.cvForm.value)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment