contact form implementation
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { BaseComponent } from '../base/base.component';
|
||||
import { CvService } from '../services/cv.service';
|
||||
import { ISideBar } from '../contact-sidebar/side-bar.model';
|
||||
import { IContact } from './contact.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-contact',
|
||||
@@ -9,6 +8,21 @@ import { ISideBar } from '../contact-sidebar/side-bar.model';
|
||||
styleUrl: './contact.component.scss'
|
||||
})
|
||||
export class ContactComponent {
|
||||
constructor(svc: CvService){
|
||||
messageModel: IContact = {name: '', fromEmail: '', content: '' };
|
||||
candidateId: number = 1;
|
||||
messageSentError: boolean = false;
|
||||
messageSentSuccess: boolean = false;
|
||||
|
||||
constructor(private svc: CvService){
|
||||
}
|
||||
|
||||
sendMessage() :void{
|
||||
this.messageSentError = false;
|
||||
this.messageSentSuccess = false;
|
||||
|
||||
this.svc.sendMessage(this.messageModel, this.candidateId).subscribe({
|
||||
next: (response) => this.messageSentSuccess = response,
|
||||
error: () => this.messageSentError = true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user