-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
#4 remember password and contact
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,5 +203,14 @@ | |
], | ||
"id": 2 | ||
} | ||
], | ||
"contact": [ | ||
{ | ||
"email": "[email protected]", | ||
"name": "hoang", | ||
"title": "hoang", | ||
"text": "abcaaaaa", | ||
"id": 1 | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,5 +26,10 @@ | |
height: 150px; | ||
} | ||
} | ||
.submit-panel{ | ||
display: flex; | ||
flex-direction: row-reverse; | ||
margin-top: 10px; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,41 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import {Component, OnInit} from '@angular/core'; | ||
import {FormBuilder, FormControl, Validators} from "@angular/forms"; | ||
import {HttpClient} from "@angular/common/http"; | ||
import {Router} from "@angular/router"; | ||
import {API_AUTH, API_URL} from "../../_api/apiURL"; | ||
import {CommonService} from "../../_service/common.service"; | ||
|
||
@Component({ | ||
selector: 'app-contact', | ||
templateUrl: './contact.component.html', | ||
styleUrls: ['./contact.component.scss'] | ||
}) | ||
export class ContactComponent implements OnInit { | ||
contactForm: any; | ||
|
||
constructor() { } | ||
constructor(private formBuilder: FormBuilder, private http: HttpClient,private commonService: CommonService, private router: Router) { | ||
} | ||
|
||
ngOnInit(): void { | ||
this.contactForm = this.formBuilder.group({ | ||
email: new FormControl("", [Validators.required, Validators.email]), | ||
name: new FormControl("", [Validators.required]), | ||
title: new FormControl("", [Validators.required]), | ||
text: new FormControl("", [Validators.required]) | ||
}) | ||
} | ||
|
||
contact() { | ||
this.http.post<any>(API_URL.CONTACT, { | ||
"email": this.contactForm.value.email, | ||
"name": this.contactForm.value.name, | ||
"title": this.contactForm.value.title, | ||
"text": this.contactForm.value.text | ||
}).subscribe(res => { | ||
this.commonService.toastSuccess("Gửi tin thành công thành công!") | ||
window.location.reload(); | ||
},error => { | ||
this.commonService.toastError("Gửi tin thất bại!!") | ||
}); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.