SHARE
TWEET

Untitled

a guest Jun 26th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. í class formController{
  2.  
  3. constructor(view){        
  4.  
  5.  
  6.     this.view = view;
  7.     this.init()
  8. }
  9.  
  10. init(){
  11.     this.form = this.view.getElementById('form')
  12.     this.company= this.view.getElementById('company')
  13.     this.student = this.view.getElementById('student')
  14.     this.teacher = this.view.getElementById('teacher')
  15.     this.allTravels = [];
  16.     this.loadAddEvent()
  17. }
  18.  
  19.  
  20. loadAddEvent(){
  21.     this.form.addEventListener('submit', this.addData);
  22.  
  23. }
  24.  
  25.  
  26. addData(e){
  27.     e.preventDefault();
  28.     const travel = {
  29.         teacher : teacher.value,
  30.         student: student.value,
  31.         company: company.value,
  32.     }
  33.  
  34.    this.allTravels.push(travel);
  35.    console.log(this.allTravels)
  36.  
  37.  }
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top