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

134
Views
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 answers
Answer question

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 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!