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

TabPanel with ngIf condition Exception #11095

Closed
magicdict opened this issue Jan 20, 2022 · 1 comment
Closed

TabPanel with ngIf condition Exception #11095

magicdict opened this issue Jan 20, 2022 · 1 comment

Comments

@magicdict
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

When a tab-panel with a ng-If condition,the whole tab-view is crash.

I find the commit

Fixed #10837 - TabView: p-tabview-ink-bar doesn't follow the size of …

  set header(header: string) {
        this._header = header;
        this.tabView.updateInkBar();
        this.tabView.cd.markForCheck();
    }

      updateInkBar() {
        if (this.navbar) {
            let tabHeader = DomHandler.findSingle(this.navbar.nativeElement, 'li.p-highlight');
            this.inkbar.nativeElement.style.width = DomHandler.getWidth(tabHeader) + 'px';
            this.inkbar.nativeElement.style.left =  DomHandler.getOffset(tabHeader).left - DomHandler.getOffset(this.navbar.nativeElement).left + 'px';
        }
    }

updateInkBar method will cause a exception,because tabHeader will be null when the tab-panel is visible via a ngIf condition.
Will you kindly check the tabHeader is null or not before set Style,

Please tell us about your environment:

  • Angular version: 13
  • PrimeNG version: Since 13.0.3
  • Browser: all
@yigitfindikli
Copy link
Contributor

Issue is not clear, please feel free to reopen with a stackblitz example.

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

No branches or pull requests

2 participants