I'm not sure where I am going wrong but I keep getting an error when using a Router Link to go to my Home page on closing a page via a button:
HTML:
<div >
<div >
<img [src]="brandLogo" [alt]="brandAlt" tabindex="0"/>
<h1 >Thanks for registering your interest!</h1>
<p >
Our marketing and research departments want to hear from you
and may contact you via email for your thoughts and feedback to make Raiys even better.
</p>
<br>
<br>
<p >
Don’t worry you can opt out at any time in your profile.
</p>
</div>
<div fxLayout="row" fxLayoutAlign="center center">
<button mat-raised-button color="primary"
aria-label="confirm communication preferences"
[routerLink]="close"
>Close
</button>
</div></div>
TS:
import { Component, OnInit } from '@angular/core';
import { appRoutesNames } from 'src/app/app.routes.names';
@Component({
selector: 'app-thank-you-feedback',
templateUrl: './thank-you-feedback.component.html',
styleUrls: ['./thank-you-feedback.component.scss']
})
export class ThankYouFeedbackComponent implements OnInit {
brandLogo = '';
brandAlt = '';
constructor() { }
ngOnInit(): void {
}
close = `${appRoutesNames.LOGIN}`
}
All that seems to happen is it applies \login to the URL and gives me a 404
CodePudding user response:
Try using
close = `/${appRoutesNames.LOGIN}`
add / to the routes will work