Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

247
Views
How invoke class method into the async method function

I have one error, When I invoke the handleRenderPage method to the async method i got error : model.js:83 Uncaught (in promise) TypeError: this.handleRenderPage is not a function

I use MVC to write todo project and in the model class I send the todo list array with handleRenderPage method and I use downloadTask to got the todo list from the server and send it to the view class this is async function:

  downloadTask = async() => {
    const url = 'http://localhost:9090/download';
    const res = await fetch(url);
    const data = await res.json();
    this.tasksList = data;
    console.log(this.tasksList);
    //down is the method 
    this.handleRenderPage(this.tasksList);
  }

and I invoked this func outside the class :

downloadBtn.addEventListener('click', () => {  
  const model = new Model();
  model.downloadTask();
})

when user click download btn app should render todo list from the server

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

beacause this.tasklist is undefined and you should invoked it in View and then controler get information in model and send it to Model module

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!