title: Uncaught (in promise) TypeError: this is undefined
body: <p>When I call deleteCategory in View Class it gives me an error.
  The error in calling del(event.target.id) inside deleteCategory.
  It worked when I called it this way directly from view Class</p>
  <pre><code>       deleteCategory(service){
          this.tbody.addEventListener('click',async  event =&gt; {
              const clicked=event.target.tagName.toLowerCase();
              if (clicked == 'a'){
                 const a= await this.service.deleteCategory(service.deleteCategory(event.target.id);
              }
          })
         }
  </code></pre>
  <hr />
  <p>Is there is a way to call the deleteCategory in Controller Class using the event handler inside View Class??</p>
  <hr />
  <pre><code>class View{
  
      constructor(){
          this.e=document.createElement.bind(document);
          this.root=document.getElementById('root');
          this.tbody=document.querySelector('[table-items]');
      }
    
      categorylist(lists){ 
          
          lists.forEach((list) =&gt; {
          const tr=createTableRow(this.tbody,&quot;&quot;);
          const td=createTableData(tr,list.name,&quot;pl-4&quot;);
          const tdEditDelete=createTableData(tr,&quot;&quot;,&quot;text-right pr-4&quot;);
          const editButton=createButton(tdEditDelete,'submit','Edit',list.id,'btn btn-primary mr-2');
          const deleteButton=createA(tdEditDelete,'Delete',list.id,'btn btn-danger');
          this.deleteButton=deleteButton;
          })  
      }
  
  
  
         deleteCategory(del){
          this.tbody.addEventListener('click',  event =&gt; {
              const clicked=event.target.tagName.toLowerCase();
              if (clicked == 'a'){     
                  del(event.target.id);     
              }
          })
      }
  }
  </code></pre>
  <pre><code>class Controller{
  
      constructor(service,view){
          this.view=view;
          this.service=service;
          this.displayCategoryList();
          this.view.deleteCategory(this.deleteCategory);
          //this.deleteCategory();
      }
  
      async displayCategoryList() {
          const lists=await this.service.getLists();
          this.lists=lists;
          this.view.categorylist(lists);
      }
      
       async deleteCategory(id){
          //console.log(id);
          
          const a= await this.service.deleteCategory(id);
      }
  
  }
  </code></pre>