Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. onSubmit() {
  2. const fd = new FormData();
  3. fd.append('resume', this.chosenFile);
  4. const data = this.contactForm.value;
  5. data['resume'] = fd;
  6. console.log(data);
  7. this.loading = true;
  8. this.data.createJobEnquiry(data).subscribe((res)=>{
  9. this.loading = false;
  10. },(err)=>{
  11. this.loading = false;
  12. console.log(err)
  13. alert("Something went wrong");
  14. });
  15. }
  16.  
  17. onSubmit() {
  18. const fd = new FormData();
  19. fd.append('resume', this.chosenFile);
  20. const data = this.contactForm.value;
  21. data['resume'] = fd;
  22. console.log(data);
  23. this.loading = true;
  24. this.data.createJobEnquiry(fd).subscribe((res)=>{
  25. this.loading = false;
  26. },(err)=>{
  27. this.loading = false;
  28. console.log(err)
  29. alert("Something went wrong");
  30. });
  31. }
  32.  
  33. <input formControlName="resume" type="file" id="real-file" (change)="onFileSelected($event)" style="display: none;">
  34.  
  35. onFileSelected(event) {
  36. this.chosenFile = <File>event.target.files[0];
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement