Navigating to a p-tabview on button click

Viewed 170

I'm new to the angular and primeNg.

I have details.component.html and there is a button called "start session" in my nav bar. I also have a <p-tabView> component in the same file.

I want to show the <p-tabView> component when I click the "start session" button. How can I achieve this?

1 Answers

if I understand correctly, you just need to render your component by clicking on the button. in this case you need:

  1. hang an event handler on the button

    <button (click)='yourButtonHandler()/>

  2. create a variable that the element will depend on

    isTabviewExist = false

  3. create function that will handle click on your button

    yourButtonHandler() { this.isTabviewExist = true }

  4. add condition to component

    <p-tabView *ngIf=isTabviewExist />

Related