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

146
Views
Infragistics: How to show multiple ignite Snackbar using id

I want to show multiple Snackbar on the angular website. I am using ignite UI for angular and using Snackbar from ignite.

<igx-snackbar id="snackbar1" [displayTime]="displayTime">
  <div [class]="leftBorder"></div>
  <div class="snackbar-detail">
    <img [class]="iconType" [alt]="('LBL_CLOSE' | translate)" [src]="iconPath">
    <div class="message-section">
      <div class="snackbar-title">{{messageTitle}}</div>
      <div class="snackbar-message">{{messageDesc}}</div>
    </div>
    <img (click)="closeSnackbar()" class="close-icon" [alt]="('LBL_CLOSE' | translate)"
      src="assets/icons/essentials/close.svg">
  </div>
</igx-snackbar>

I am able to show the snacbar using

 @ViewChild(IgxSnackbarComponent, { static: true }) public igxSnackBar: IgxSnackbarComponent;

 this.igxSnackBar.show();
 

but I want to show another snackbar so I have added id="snackbar1" and able to get the id using

let snackbarId = this.igxSnackBar.id;
console.log(snackbarId);

but I am not able to open the particular snackbar using the id.

can anyone please help me with this?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Why dont you use a specific @ViewChild selector for each of the Snackbar components. You can use a template reference variable:

<igx-snackbar #snackbar1 [autoHide]="false" actionText="CLOSE" (clicked)="close(snackbar1)">Message sent</igx-snackbar>

..

A template reference variable 'snackbar1'

@ViewChild('snackbar1', { static: true }) public igxSnackBar: IgxSnackbarComponent;

With the current implementation that you shared the change detector will look for the first Snackbar in the DOM.

Using of show() method is deprecated in the newer versions, use open() instead.

over 4 years ago · Santiago Trujillo 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!