Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When ngFor used within accordion body accordion does not resize appropriately. #836

Closed
1 of 2 tasks
stubbsy345 opened this issue Sep 30, 2018 · 7 comments · Fixed by #882
Closed
1 of 2 tasks

When ngFor used within accordion body accordion does not resize appropriately. #836

stubbsy345 opened this issue Sep 30, 2018 · 7 comments · Fixed by #882

Comments

@stubbsy345
Copy link

Issue type

I'm submitting a ... (check one with "x")

  • bug report
  • feature request

Issue description

When ngFor is used within an accordion body, the body does not resize appropriately when toggled. The body only seems to resize to static content.

Steps to reproduce:

Related code:

<nb-accordion>
      <nb-accordion-item>
                <nb-accordion-item-body>
                          <div *ngFor="let q of questions">{{ q }}</div>
                 </nb-accordion-item-body>
      </nb-accordion-item>
</nb-accordion>

Angular, Nebular

Angular: 6.1.7
Nebular: 2.0.0-rc.10
@stubbsy345
Copy link
Author

stubbsy345 commented Sep 30, 2018

Problem solved by changing component implementation for NbAccordionItemBodyComponent to AfterViewInit rather than OnInIt in the nebular package.

EDIT: Just noticed that this change has already in commit 8c7953f though this commit is not merged yet.

@stubbsy345
Copy link
Author

Sorry can I confirm has this been fixed on the most recent stable release?

@nnixaa
Copy link
Collaborator

nnixaa commented Oct 4, 2018

Hi @stubbsy345, no, unfortunately, but we hopefully will be able to make it in upcoming releases.

@Prokksi
Copy link

Prokksi commented Oct 9, 2018

Hi, the solution provided does work when doing a ng serve but not when using --prod or --aot, because the ngOnInit function is then missing (which results in an error) and the ngAfterViewInit Function seems never to be called (and the accordion-item-body has no height). Do you have an idea to solve the problem?

@lexzhukov lexzhukov self-assigned this Oct 10, 2018
@issue-sh issue-sh bot added Sprint and removed Backlog labels Oct 11, 2018
@issue-sh issue-sh bot removed the Sprint label Oct 15, 2018
nnixaa pushed a commit that referenced this issue Oct 15, 2018
@diegoalex
Copy link

Hi Guys,
I did a workaround to fix my code until we have a new version released.

I'm using just this peace of scss in the component I have the accordion.

/deep/ nb-accordion-item.expanded nb-accordion-item-body { .ng-trigger-accordionItemBody { height: auto !important; } }

I hope it will help u guys too ;)

@diegohosilver
Copy link

Hi Guys,
I did a workaround to fix my code until we have a new version released.

I'm using just this peace of scss in the component I have the accordion.

/deep/ nb-accordion-item.expanded nb-accordion-item-body { .ng-trigger-accordionItemBody { height: auto !important; } }

I hope it will help u guys too ;)

Saved my day. Thanks bud

@MarcoFiusco
Copy link

@diegoalex Thank you for the solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants