I created a modal, when the user clicks on confirm
, I would like the user to be redirected to the page => securities-in-portfolio
.
<div >
<button type="button" (click)="confirm()">
Confirm
</button>
</div>
Do you know how to write this in TS, please?
CodePudding user response:
Yep. in your component file. You have to have a method named confirm. it looks like:
constructor(private readonly router: Router // -> add this) {}
confirm() {
this.router.navigateByUrl('/ROUTE_TO_SECURITIES_IN_PORTFOLIO');
}
CodePudding user response:
Try routerlink
Instead of
(click)="confirm()"
Use
[routerLink]="['/securities-in-portfolio']"