diff --git a/src/app/components/tabview/tabview.ts b/src/app/components/tabview/tabview.ts index 87eaff90679..3fcb62c7c55 100755 --- a/src/app/components/tabview/tabview.ts +++ b/src/app/components/tabview/tabview.ts @@ -120,6 +120,7 @@ export class TabPanel implements AfterContentInit,OnDestroy { set header(header: string) { this._header = header; + this.tabView.updateInkBar(); this.tabView.cd.markForCheck(); } @@ -380,9 +381,11 @@ export class TabView implements AfterContentInit,AfterViewChecked,BlockableUI { } updateInkBar() { - 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'; + 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'; + } } updateScrollBar(index) {