Add the contact form
continuous-integration/drone/push Build is passing Details

pull/1/head
Colin FRIZOT 2 years ago
parent 64e213cf1c
commit 530d11de99

@ -10,6 +10,8 @@ import { OutputComponent } from './output/output.component';
import { LandingPageComponent } from './landing-page/landing-page.component'; import { LandingPageComponent } from './landing-page/landing-page.component';
import { DocumentationComponent } from './documentation/documentation.component'; import { DocumentationComponent } from './documentation/documentation.component';
import { FormComponent } from './form/form.component'; import { FormComponent } from './form/form.component';
import { ReactiveFormsModule } from '@angular/forms';
@NgModule({ @NgModule({
@ -25,7 +27,8 @@ import { FormComponent } from './form/form.component';
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
AppRoutingModule AppRoutingModule,
ReactiveFormsModule
], ],
providers: [], providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent]

@ -24,7 +24,7 @@
</div> </div>
<div> <div>
<button type="submit" [disabled]="!form.valid">Envoyer</button> <button type="submit" (click)="send()" [disabled]="!form.valid">Envoyer</button>
</div> </div>
</div> </div>

@ -1,6 +1,5 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms'; import { FormBuilder, FormGroup } from '@angular/forms';
import { ReactiveFormsModule } from '@angular/forms';
import emailjs from '@emailjs/browser'; import emailjs from '@emailjs/browser';
@ -15,7 +14,7 @@ export class FormComponent {
constructor(private fb: FormBuilder) { constructor(private fb: FormBuilder) {
this.form = this.fb.group({ this.form = this.fb.group({
from_name: [''], from_name: [''],
to_name: ['Sankasten'], to_name: ['Sandkasten'],
from_email: [''], from_email: [''],
subject: [''], subject: [''],
message: [''] message: ['']
@ -23,9 +22,9 @@ export class FormComponent {
} }
async send() { async send() {
emailjs.init('user_your_user_id'); emailjs.init('cLIr6GuwhkrH1JFio');
try { try {
let response = await emailjs.send("your_service_id", "your_template_id", { let response = await emailjs.send("service_rvmwu94", "template_q0spe61", {
from_name: this.form.value.from_name, from_name: this.form.value.from_name,
to_name: this.form.value.to_name, to_name: this.form.value.to_name,
message: this.form.value.message, message: this.form.value.message,

Loading…
Cancel
Save