In my project in the first component I have an input box, and a button.
<div routerLink="questions" (click)="btnClicked(target.value)" class="button">Click Me</div>
In the app.module.ts I set up the router, and it is working this way, but the problem is that in the btnClicked() function I'm checking if the user input is valid, and this way, it doesn't matter if the input is valid or not, the program will navigate to the questions component, so I'd like to do this routing in the typescript file, right after the validation.
Any suggestions? Thank you guys for the answer(s).