Skip to content

Use case for tabs component #3510

Discussion options

You must be logged in to vote

Hi @Leonardonline ,
you may use another approach:

  1. Use 2-ways binding
<p-tabs [(value)]="tabIndex">
  1. Define a model
tabIndex = model(2) // <== you can also set the default tab to open, i.e. 2
  1. Listen for changes
  constructor() {
    effect(() => {
      console.log(this.tabIndex())
    });
  }
  1. Change Tab programmatically
this.tabIndex.set(1)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Leonardonline
Comment options

Answer selected by Leonardonline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants