Last active
December 4, 2020 06:57
-
-
Save Bilkiss/57d04051fd81a9e696f274429423d958 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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