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

Reimplement TabView Lazy Loading #3295

Closed
bnymncoskuner opened this issue Jul 4, 2017 · 6 comments
Closed

Reimplement TabView Lazy Loading #3295

bnymncoskuner opened this issue Jul 4, 2017 · 6 comments
Assignees
Labels
Type: New Feature Issue contains a new feature or new component request
Milestone

Comments

@bnymncoskuner
Copy link

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

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)
http://plnkr.co/edit/C5Al07WC58f0MNNemUBL?p=preview

Current behavior

When lazy prop of TabView is set, all the inactive tabs are initialized regardless (with service call and everything).

Expected behavior

When lazy prop is set to true, it should wait until the user clicks on tab to initialize the related template/component.

Minimal reproduction of the problem with instructions

You can reproduce this bug on following plnkr. Open the console and you'll see following lines

http://plnkr.co/edit/C5Al07WC58f0MNNemUBL?p=preview

first component constructor
second component constructor
first component ngOnInit
second component ngOnInit

Since, I set [lazy]=true, it should not initialize second component and log out its messages.

On the other hand, if you change the line
<second></second>
to
<second *ngIf="selectedIndex == 1"></second>
in app.template.html, it works as expected.
However, I should not use ngIf if there is a lazy prop of the component.

  • Angular version: 4.0.0
  • PrimeNG version: 4.1.0-rc.2
@scottieslg
Copy link

I'm experiencing the same problem.

@kjocevicius
Copy link

Same problem. Also, according to documentation [lazy] should be on tabPanel, however the property isn't available on this component.

@rhornrrs
Copy link

rhornrrs commented Aug 1, 2017

I'm having the same problem

Angular 4.1.1
PrimeNg 4.1.1

@rogerleuthner
Copy link

Problem persists:
PrimeNg 4.1.2
Angular 4.2.0

Expectation on this guides a design decision; projected action would be helpful; thanks a bunch.

@cagataycivici cagataycivici self-assigned this Aug 23, 2017
@cagataycivici cagataycivici added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Aug 23, 2017
@cagataycivici cagataycivici added this to the 4.1.4 milestone Aug 23, 2017
@cagataycivici cagataycivici added Type: New Feature Issue contains a new feature or new component request and removed Status: Pending Review Issue or pull request is being reviewed by Core Team labels Aug 25, 2017
@cagataycivici
Copy link
Member

As lazy does not work as advertised, had to rewrite it with a pTemplate.

 <p-tabPanel header="second" cache="true">
          <ng-template pTemplate="content">
              <second></second>
          </ng-template>
      </p-tabPanel>

cache property is optional and decides if it should be loaded again when tab gets re-selected.

@cagataycivici cagataycivici changed the title TabView lazy loading not working Reimplement TabView Lazy Loading Aug 25, 2017
@manjeet13
Copy link

is this resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Feature Issue contains a new feature or new component request
Projects
None yet
Development

No branches or pull requests

7 participants