0

i am using primeNg p-accordion tab on my code.i given a ngIf condition in p-accordionTab.now sometimes tab is not opening.(onOpen)="handleAccordinChange($event) click is not calling.if i remove if condition its working.can anyone help?

<p-accordion
      [activeIndex]="selectedAccordinIndex"
      (onClose)="handleAccordinChange($event)"
      (onOpen)="handleAccordinChange($event)"
    >
<p-accordionTab *ngIf="adminAuthority===true" >
        <p-header>Tools</p-header>
<div class="form-group">
    <small class="form-text text-muted m-1">
      {{'prAssignReviewers.reassignHelptext' | translate }}
    </small>
    <span class="btn-group btn-group-sm">
      <button type="button" class="btn btn-warning" >click</button>
    </span>
  </div>
</p-accordionTab>
</p-accordion>

ts code

@Input() adminAuthority;                                                                          
 handleAccordinChange(e) {
    this.selectedAccordinIndex = e.index; 
  }
bibin te
  • 3
  • 3
  • Can you provide details of when you are changing value of adminAuthority and it's initial value? You didn't provide details of handleAccordinChange($event). Provide related functions of .ts – Eranki Feb 12 '20 at 06:55
  • @Input() adminAuthority; it's initial value – bibin te Feb 12 '20 at 07:01
  • Attach your .ts code in your question. It's not clear. – Eranki Feb 12 '20 at 07:03

2 Answers2

0

It seems like error in html tags there should be only one p-accordionTab tag in this case:

    <p-accordionTab>
<p-accordionTab *ngIf="adminAuthority===true" >
sacgro
  • 459
  • 2
  • 5
0

Check @Input() adminAuthority; is boolean.

If adminAuthority = false then, no accordian is rendered, hence no (onOpen) is called If adminAuthority = true then, (onOpen) is called on clicking the accordian header

Refer this in case the adminAuthority input is taking more time to set

Rajesh K
  • 161
  • 1
  • 3