4
 <button color="dark" fill="outline"  [routerLink]="['/home']" size="medium"
          >Click here to add some</button>

how should I pass replace URL option just like we do in the TS file

 await this.router.navigate(['/profile'], { replaceUrl: true });

3 Answers 3

8

I found it myself by seeing type file of angular routing :) here is how I do it

<button color="dark" fill="outline" replaceUrl="true"   routerLink="['/home']" size="medium"
              >Click here to add some</button>
Sign up to request clarification or add additional context in comments.

3 Comments

I tried this, but I just get an error saying type 'string' is not assignable to type 'boolean'. Any insight as to what's going on there?
fixed now its because of useless binding @PaulBunion
This still gives me the error described above
0
<button replaceUrl="true" routerLink="/home">Click here to add some</button>

You dont have to use [] for replaceUrl and routerLink if those are not bound but simple values.

Comments

0

The selected answer is correct, but now in Angular you also need to bind those properties, even for booleans, like this:

<button [replaceUrl]="true" [routerLink]="['/home']">Click here to add some</button>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.