Dynamically Add tabPanel to tabView in PrimeNg The 2019 Stack Overflow Developer Survey Results Are InPrimeNG - How to dynamically add and remove a p-tabPanel in p-tabView componentPrimeNg component tabView onChange how to getId from tabPanelGet current header of the tabView PrimeNGprimeng tabview angular issue setting active tab in codeprimeNG programmatically change tab when using *ngFor on tabPanelStyling PrimeNG p-tabViewPrimeNG VirtualScroller in TabView not working out properlyPrimeNg TabView with ConfirmDialogPrimeng selected dynamic p-tabPanel
What do hard-Brexiteers want with respect to the Irish border?
ODD NUMBER in Cognitive Linguistics of WILLIAM CROFT and D. ALAN CRUSE
Getting crown tickets for Statue of Liberty
Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?
Can a rogue use sneak attack with weapons that have the thrown property even if they are not thrown?
How to support a colleague who finds meetings extremely tiring?
If a sorcerer casts the Banishment spell on a PC while in Avernus, does the PC return to their home plane?
What's the name of these plastic connectors
How can I define good in a religion that claims no moral authority?
Why didn't the Event Horizon Telescope team mention Sagittarius A*?
Why isn't the black hole white?
"as much details as you can remember"
Will it cause any balance problems to have PCs level up and gain the benefits of a long rest mid-fight?
Why doesn't shell automatically fix "useless use of cat"?
How to notate time signature switching consistently every measure
Pokemon Turn Based battle (Python)
What is preventing me from simply constructing a hash that's lower than the current target?
What is the motivation for a law requiring 2 parties to consent for recording a conversation
How do PCB vias affect signal quality?
Are turbopumps lubricated?
writing variables above the numbers in tikz picture
Does HR tell a hiring manager about salary negotiations?
How to translate "being like"?
Why doesn't UInt have a toDouble()?
Dynamically Add tabPanel to tabView in PrimeNg
The 2019 Stack Overflow Developer Survey Results Are InPrimeNG - How to dynamically add and remove a p-tabPanel in p-tabView componentPrimeNg component tabView onChange how to getId from tabPanelGet current header of the tabView PrimeNGprimeng tabview angular issue setting active tab in codeprimeNG programmatically change tab when using *ngFor on tabPanelStyling PrimeNG p-tabViewPrimeNG VirtualScroller in TabView not working out properlyPrimeNg TabView with ConfirmDialogPrimeng selected dynamic p-tabPanel
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I wanted to have a 'Add Tab' button, on clicking that button i want to add a new Tab(tabPanel) to existing list of tabView.
Till now i am able to achieve the addition of new tab on clicking a 'Add Tab' button but i am not sure how to add the dynamic html content to the tab.
appComponent.html
<button pButton (click)="addTab()" label="selected header"></button>
<p-tabView (onChange)="onChange($event)" [activeIndex]="selectedIndex">
<p-tabPanel header="first" [selected]="true">
Hello1
</p-tabPanel>
<p-tabPanel header="second" cache="false">
hello2
</p-tabPanel>
</p-tabView>app.component.ts
import Component, ViewChild, ViewContainerRef from '@angular/core';
import TabView, TabPanel from 'primeng/primeng';
@Component(
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
)
export class AppComponent
constructor(private viewContainerRef: ViewContainerRef)
@ViewChild(TabView) tabView: TabView;
addTab()
const tab: TabPanel = new TabPanel(this.viewContainerRef);
tab.header = 'Tab3';
tab.closable = true;
this.tabView.tabs.push(tab);
add a comment |
I wanted to have a 'Add Tab' button, on clicking that button i want to add a new Tab(tabPanel) to existing list of tabView.
Till now i am able to achieve the addition of new tab on clicking a 'Add Tab' button but i am not sure how to add the dynamic html content to the tab.
appComponent.html
<button pButton (click)="addTab()" label="selected header"></button>
<p-tabView (onChange)="onChange($event)" [activeIndex]="selectedIndex">
<p-tabPanel header="first" [selected]="true">
Hello1
</p-tabPanel>
<p-tabPanel header="second" cache="false">
hello2
</p-tabPanel>
</p-tabView>app.component.ts
import Component, ViewChild, ViewContainerRef from '@angular/core';
import TabView, TabPanel from 'primeng/primeng';
@Component(
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
)
export class AppComponent
constructor(private viewContainerRef: ViewContainerRef)
@ViewChild(TabView) tabView: TabView;
addTab()
const tab: TabPanel = new TabPanel(this.viewContainerRef);
tab.header = 'Tab3';
tab.closable = true;
this.tabView.tabs.push(tab);
add a comment |
I wanted to have a 'Add Tab' button, on clicking that button i want to add a new Tab(tabPanel) to existing list of tabView.
Till now i am able to achieve the addition of new tab on clicking a 'Add Tab' button but i am not sure how to add the dynamic html content to the tab.
appComponent.html
<button pButton (click)="addTab()" label="selected header"></button>
<p-tabView (onChange)="onChange($event)" [activeIndex]="selectedIndex">
<p-tabPanel header="first" [selected]="true">
Hello1
</p-tabPanel>
<p-tabPanel header="second" cache="false">
hello2
</p-tabPanel>
</p-tabView>app.component.ts
import Component, ViewChild, ViewContainerRef from '@angular/core';
import TabView, TabPanel from 'primeng/primeng';
@Component(
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
)
export class AppComponent
constructor(private viewContainerRef: ViewContainerRef)
@ViewChild(TabView) tabView: TabView;
addTab()
const tab: TabPanel = new TabPanel(this.viewContainerRef);
tab.header = 'Tab3';
tab.closable = true;
this.tabView.tabs.push(tab);
I wanted to have a 'Add Tab' button, on clicking that button i want to add a new Tab(tabPanel) to existing list of tabView.
Till now i am able to achieve the addition of new tab on clicking a 'Add Tab' button but i am not sure how to add the dynamic html content to the tab.
appComponent.html
<button pButton (click)="addTab()" label="selected header"></button>
<p-tabView (onChange)="onChange($event)" [activeIndex]="selectedIndex">
<p-tabPanel header="first" [selected]="true">
Hello1
</p-tabPanel>
<p-tabPanel header="second" cache="false">
hello2
</p-tabPanel>
</p-tabView>app.component.ts
import Component, ViewChild, ViewContainerRef from '@angular/core';
import TabView, TabPanel from 'primeng/primeng';
@Component(
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
)
export class AppComponent
constructor(private viewContainerRef: ViewContainerRef)
@ViewChild(TabView) tabView: TabView;
addTab()
const tab: TabPanel = new TabPanel(this.viewContainerRef);
tab.header = 'Tab3';
tab.closable = true;
this.tabView.tabs.push(tab);
<button pButton (click)="addTab()" label="selected header"></button>
<p-tabView (onChange)="onChange($event)" [activeIndex]="selectedIndex">
<p-tabPanel header="first" [selected]="true">
Hello1
</p-tabPanel>
<p-tabPanel header="second" cache="false">
hello2
</p-tabPanel>
</p-tabView><button pButton (click)="addTab()" label="selected header"></button>
<p-tabView (onChange)="onChange($event)" [activeIndex]="selectedIndex">
<p-tabPanel header="first" [selected]="true">
Hello1
</p-tabPanel>
<p-tabPanel header="second" cache="false">
hello2
</p-tabPanel>
</p-tabView>import Component, ViewChild, ViewContainerRef from '@angular/core';
import TabView, TabPanel from 'primeng/primeng';
@Component(
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
)
export class AppComponent
constructor(private viewContainerRef: ViewContainerRef)
@ViewChild(TabView) tabView: TabView;
addTab()
const tab: TabPanel = new TabPanel(this.viewContainerRef);
tab.header = 'Tab3';
tab.closable = true;
this.tabView.tabs.push(tab);
import Component, ViewChild, ViewContainerRef from '@angular/core';
import TabView, TabPanel from 'primeng/primeng';
@Component(
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
)
export class AppComponent
constructor(private viewContainerRef: ViewContainerRef)
@ViewChild(TabView) tabView: TabView;
addTab()
const tab: TabPanel = new TabPanel(this.viewContainerRef);
tab.header = 'Tab3';
tab.closable = true;
this.tabView.tabs.push(tab);
asked Mar 8 at 10:56
Neeraj Kumar SaroyaNeeraj Kumar Saroya
12
12
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061736%2fdynamically-add-tabpanel-to-tabview-in-primeng%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061736%2fdynamically-add-tabpanel-to-tabview-in-primeng%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown