如何添加routerlink而不是带有角度字符串插值的“a href”

问题描述

我有一个完整的句子

I have read the <a href="xyz">Terms and Conditions</a>,<a href="xyz" target="_blank">Privacy Policy</a> and <a href="xyz">Legal Notice</a> and I fully agree to it without any concerns whatever blahblah

现在我们要使用 RouterLink 而不是 HTML -Tag。但是我们不想将翻译分成多个部分并在最后连接它(有时甚至不起作用,因为链接顺序因某种语言而异)。

是否有解决方案如何在 Angular 中实现这一点?

解决方法

尝试使用:

Component.ts

xyz:any = '/page1';

component.html

I have read the <a routerLink="{{xyz}}">Terms and Conditions</a>,<a routerLink="{{xyz}}" target="_blank">Privacy Policy</a> and <a href="xyz">Legal Notice</a> and I fully agree to it without any concerns whatever blahblah

这会帮助你....