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
How to use loader component when switch another language

I want to share with you my code, because I want to call loader component when I'm switching language.

In here is app.component.html

 <div class="row sol">
    <angular-loader></angular-loader> 
    <main id="contenutoprincipale" class="col-xs-12 col-sm-8 col-lg-9">
    <div class="dropdown-language">
    <label>{{'GENERALE.LINGUA' | translate }}</label>
        <select #langSelect (change)="translate.use(langSelect.value)" class="lang-style">
          <option *ngFor="let lang of translate.getLangs()" [value]="lang" [selected]="lang === translate.currentLang">{{ lang }}</option>
        </select>
    </div>
    <router-outlet></router-outlet>
    </main> 
  </div>

In app.component.ts I have this simple code:

   translate.addLangs(commonEnvironment.availableLanguages);
    translate.setDefaultLang(commonEnvironment.defaultLanguage);
    const browserLang = translate.getBrowserLang();
    translate.use(browserLang.match(/en/) ? browserLang : 'en');

in angular-loader I have this code:

export class LoaderComponent implements OnInit {
    show = false;
    private subscription: Subscription;
    constructor(private loaderService: LoaderService) { }

    ngOnInit() {
        this.subscription = this.loaderService.loaderState.subscribe(
            (state: LoaderState) => {
                if (state.queue.length > 0) {
                    this.show = true;
                } else {
                    this.show = false;
                }
            });
    }
}

My question is how to call loader module when I switch another language ?

about 4 years ago · Juan Pablo Isaza
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!