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

181
Views
UI flicker when array is changed angular 11

I am contacting an array on value updated by the server, but the UI template flicker on concat.. what should be done to avoid such a situation.

   @Input('companies')   set setCompanyArray(companies) {
     this.showNotFound = false;> 
     if (!companies) {
       return;
     }
     companies.map((company) => {
       company['searchFilter'] = this.lastSearchedText;
    });
    if (!this.companies) {
       this.companies = companies;
       return;
     }
     this.companies = this.companies.concat(companies);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Each time you assign a new value to companies variable, you will see flickering because Angular is rendering the whole list again. You should add trackByFn to tell Angular whether to rerender the whole list or just new items.

 <li *ngFor="let company of companies;trackBy: trackByFn"></li>

  trackByFn(index, company: Company) {

    return company.id // or whatever is an unique identificator for a company
  }
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!