|
|
|
@@ -0,0 +1,39 @@ |
|
|
|
import {Component} from '@angular/core'; |
|
|
|
import {FormBuilder, FormGroup, Validators} from "@angular/forms"; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'app-new-contact', |
|
|
|
templateUrl: './new-contact.component.html', |
|
|
|
styleUrl: './new-contact.component.scss' |
|
|
|
}) |
|
|
|
export class NewContactComponent { |
|
|
|
protected contactForm: FormGroup; |
|
|
|
protected selectedImage: File | null; |
|
|
|
constructor( |
|
|
|
private fb: FormBuilder |
|
|
|
) { |
|
|
|
this.contactForm = this.fb.group({ |
|
|
|
firstName: ['', [Validators.required]], |
|
|
|
lastName: ['', [Validators.required]], |
|
|
|
email: ['', [Validators.required, Validators.email]], |
|
|
|
phone: [''], |
|
|
|
position: [''], |
|
|
|
}); |
|
|
|
this.selectedImage = null; |
|
|
|
} |
|
|
|
|
|
|
|
onSubmit() { |
|
|
|
if (this.contactForm.valid) { |
|
|
|
// Hier können Sie die Daten senden oder weitere Aktionen durchführen |
|
|
|
console.log(this.selectedImage); |
|
|
|
console.log('Formular wurde gesendet:', this.contactForm.value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
onFileSelected(event: any) { |
|
|
|
const file: File = event.target.files[0]; |
|
|
|
if (file) { |
|
|
|
this.selectedImage = file; |
|
|
|
} |
|
|
|
} |
|
|
|
} |