【发布时间】:2019-11-16 03:13:21
【问题描述】:
尝试格式化包含多个文本链接的段落或句子。这些链接将是路由器链接,而不是外部网络链接。
看起来您可以使用 FormattedString 和 Span 格式化文本,但似乎您无法将 nsRouterLink 添加到 Span。
<Label class="terms">
<FormattedString>
<Span text="By creating an account, you agree to the our "></Span>
<Span
text="Terms of Use"
class="link"
[nsRouterLink]="['/policies/terms-of-use']"
pageTransition="slideLeft"
></Span>
<Span text=" and "></Span>
<Span
text="Privacy Policy"
class="link"
[nsRouterLink]="['/policies/privacy-policy']"
pageTransition="slideLeft"
></Span>
<Span text="."></Span>
</FormattedString>
</Label>
如果我可以让整个内容都可点击,我可以将所有内容都包裹在一个按钮中,但正如您在示例中看到的那样,那里有两个单独的链接。
【问题讨论】:
标签: angular nativescript angular2-nativescript