How to change tabs with a function?

I need to change a tabs whenever a certain thing happen in my page. So it needs to change to another tab even if the user didn’t click the tab icon. How can i do that?

Would using the default angular router’s navigate() or navigateByUrl() work for this?