File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,23 +11,24 @@ <h2 class="heading heading--primary">{{ 'contact-header' | translate }}</h2>
1111 </ header >
1212 </ div >
1313 < div class ="contact__col ">
14- < form class ="contact__form " (ngSubmit) ="sendMessage() ">
14+ < form class ="contact__form " (ngSubmit) ="sendMessage() " ngNativeValidate >
1515 < div class ="contact__input-box ">
1616 < label for ="email " class ="contact__input-label "> {{ 'email' | translate }}</ label >
17- < input type ="email " id ="email " class ="contact__input-input " placeholder ="{{ 'email-placeholder' | translate }} " [(ngModel)] ="email " name ="email " required >
17+ < input type ="email " id ="email " class ="contact__input-input " placeholder ="{{ 'email-placeholder' | translate }} " [(ngModel)] ="email " name ="email " required ="" >
1818 </ div >
1919 < div class ="contact__input-box ">
2020 < label for ="phone " class ="contact__input-label "> {{ 'phone' | translate }}</ label >
2121 < input type ="tel " id ="phone " class ="contact__input-input " placeholder ="+48 795 691 258 " [(ngModel)] ="phone " name ="phone ">
2222 </ div >
2323 < div class ="contact__input-box ">
2424 < label for ="message " class ="contact__input-label "> {{ 'message' | translate }}</ label >
25- < textarea id ="message " class ="contact__input-textarea " placeholder ="{{ 'message-placeholder' | translate }} " [(ngModel)] ="message " name ="message "> </ textarea >
25+ < textarea id ="message " class ="contact__input-textarea " placeholder ="{{ 'message-placeholder' | translate }} " [(ngModel)] ="message " name ="message " required > </ textarea >
2626 </ div >
2727 < button type ="submit " class ="button button--primary ">
2828 < span class ="button-text "> {{ 'send' | translate }}</ span >
2929 < span class ="button-icon button-icon--right "> ▼</ span >
3030 </ button >
31+ < p *ngIf ="success " class ="contact__header-paragraph "> {{ 'send-text' | translate }}</ p >
3132 </ form >
3233 </ div >
3334</ section >
Original file line number Diff line number Diff line change 11import { Component , OnInit } from '@angular/core' ;
2- import { HttpClient , HttpHeaders } from '@angular/common/http' ;
2+ import { HttpClient } from '@angular/common/http' ;
33
44@Component ( {
55 selector : 'app-contact' ,
@@ -10,22 +10,24 @@ export class ContactComponent implements OnInit {
1010 email : string ;
1111 phone : string ;
1212 message : string ;
13+ success : boolean ;
1314
1415 constructor ( private http : HttpClient ) { }
1516
1617 ngOnInit ( ) {
1718 }
1819
1920 async sendMessage ( ) {
20- const params = {
21- email : this . email ,
22- phone : this . phone ,
23- message : this . message
24- } ;
25- const response = await this . http . post ( 'http://localhost:3000/api/message/add' , params , {
26- headers : new HttpHeaders ( {
27- 'Content-Type' : 'application/json'
28- } )
29- } ) ;
21+ const params = new FormData ( ) ;
22+ params . append ( 'email' , this . email ) ;
23+ params . append ( 'message' , this . message ) ;
24+ params . append ( 'phone' , this . phone ) ;
25+ console . log ( 'send msg' , params ) ;
26+
27+ this . http
28+ . post ( 'https://tymdev.pl/api/routes/sendMail.php' , params )
29+ . subscribe ( ( ) => {
30+ this . success = true ;
31+ } ) ;
3032 }
3133}
Original file line number Diff line number Diff line change 2222 < span (click) ="scrollToElement('contact') "> {{ 'contact' | translate }}</ span >
2323 </ li >
2424 < li >
25- < a href ="http://tymdev.pl/admin "> {{ 'clientsInNav' | translate }}</ a >
25+ < a href ="http://admin. tymdev.pl "> {{ 'clientsInNav' | translate }}</ a >
2626 </ li >
2727 </ ul >
2828 </ div >
Original file line number Diff line number Diff line change 2626 "message" : " Message" ,
2727 "message-placeholder" : " Hey! We would like to have you in our team. Check out our job offer and join us!" ,
2828 "send" : " Send" ,
29+ "send-text" : " Send! Thank you for contacting me!" ,
2930 "company" : " Ltd." ,
3031 "contact" : " Contact"
3132}
Original file line number Diff line number Diff line change 2626 "message" : " Wiadomość" ,
2727 "message-placeholder" : " Hej! Chcielibyśmy mieć Cie w naszym zespole. Sprawdź naszą ofertę pracy i dołącz do nas!" ,
2828 "send" : " Wyślij" ,
29+ "send-text" : " Wysłano! Dziękujemy za kontakt!" ,
2930 "company" : " sp. z o. o." ,
3031 "contact" : " Kontakt"
3132}
You can’t perform that action at this time.
0 commit comments