html - 有没有办法将html类和目标链接文本转换为普通链接文本
问题描述
我正在使用 innerhtml 在我的应用程序中绑定聊天消息。从服务器端我发送了一条消息,我正在尝试将 html 内容转换为角度 6 中的普通链接内容。
<a href="https://helloworld.com/test"" class="linkified" target="_blank">https://helloworld.com/test"</a>
在客户端我得到的输出为
https://helloworld.com/test" class="linkified" target="_blank">https://helloworld.com/test" class="linkified" target="_blank">" class="linkified" target="_blank">https://helloworld.com/test" class="linkified" target="_blank">https://helloworld.com/test
如何在我的聊天窗口中显示正常的超链接。我的输出应该是https://helloworld.com/test "
我的聊天窗口设计为
<p [innerHTML]="msgObj.message" class="mr-2 pr-1 mb-0"></p>
在我们的应用程序中收到消息时。在 api 中显示为
{"message": "<a href="<a href="https://helloworld.com/test"" class="linkified" target="_blank">https://helloworld.com/test&quot</a>;" class="linkified" target="_blank"><a href="https://helloworld.com/test"</a>" class="linkified" target="_blank">https://helloworld.com/test"</a></a>"}
解决方案
推荐阅读
- java - VS-Code 中的 Java 项目,“vscode.java.validateLaunchConfig 没有 delegateCommandHandler”错误
- javascript - 访问按钮内的复选框值
- d3.js - D3js - 具有二进制值的折线图
- android - 如何在 Android 上的 Firebase 数据库中存储用户 Uid?
- angular - 如何将自定义配置传递给 ngx-imageviewer
- javascript - 在多个查询中使用 document.querySelectorALL 添加/删除类
- r - 如何编写一个 for 循环来解析 R 中的三个不同变量?
- databricks - Databricks - 如何将驱动程序日志复制到我的机器上?
- c# - 显示垂直滚动条时控制位置发生变化
- abap - 方法“GET_DATA_REF”不存在(cl_salv_bs_runtime_info),为什么?