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

135
Visualizações
typescript private variables message

In my typescript class I have two private variables. One variable is goping to store a string that I am returning from an API. The other one is a message that I will be displaying to the user. Once the API is completed and will use the return and build the full message. In the response I am setting this.templatIds so it will build the message with the correct ids that. But in my popup message its missing the section from the string.

export class AgentsGridComponent implements AfterViewInit {
    private templatIds = "";
    private inuseItemMessage = `This Agent is being used by Templates ${this.templatIds} and can't be archived`




this.agentsService.inuseTemplateAgentList(data.item.Id)
                    .then((response) => {
                        console.log(response.Value);
                        this.templatIds = response.Value;
                        this.notificationManager.error(inuseItemMessage);
                    });
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The templatIds is not populated at the time that the inuseItemMessage is assigned to - they both get assigned at the same time, at the beginning of the constructor. Make the message into a function instead, so it can construct the template string from the now-populated templatIds on demand.

private getInUseMessage = () => `This Agent is being used by Templates ${this.templatIds} and can't be archived`
this.notificationManager.error(this.getInUseMessage());
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