Directing user to an ion-tab using function


I have an ion-tab which I need to redirect the user to using the click() function in JavaScript. Any ideas please or any references to docs please?
This is my code:

<ion-tab tab="list">
            <ion-title>This is the header area</ion-title>

        <ion-label>This is the content area</ion-label>

<ion-tab-bar slot="bottom">
    <ion-tab-button tab="list">
        <ion-icon name="list-outline"></ion-icon>

function goToListTab()
    // How do I direct the user to the Ionic tab named "list" using click()


I used onclick="console.log(this)" in the ion-tab-button to get the id of the button then used document.getElementById().click() in the function to automatically redirect the user to the list tab when the function runs

Answered By – Student

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published