Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

248
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda