简体   繁体   中英

How to specify replace url option in router link angular html template

 <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 });

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>
<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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM