I would like to give user the chance to hit cancel on a form. This component only has the form displayed. I would like to put the cancel button inside of the form so it sits next to the submit button, but when user triggers the cancel button, I want to change routes and display the about component.
Whenever I try any of these:
`
onCancel(){
return this.location.back();
}
`
`
onCancel(){
return this.router.navigate(['/about']);
}
`
`
<mat-card-actions>
<button mat-raised-button [disabled]="!contactForm.valid" color="primary" type="submit">Submit</button>
<button mat-raised-button color="warn" routerLink="/about">Cancel</button>
</mat-card-actions>
`
The transition of the route is temporarily paused, the URL on the page changes to the correct path, however it appends a ? right after the about? path, and then after about 2 seconds it changes the route.
How can I include the cancel button in the form?