javascript - 如何在js中将html内容添加到静态文本中

标签 javascript jquery html angularjs

我想显示来自js的静态内容以及其中的图像

content = {
    message: "The best city in the world?"
    answer:" Paris is one of the best city.'<img src ='assets/paris.gif alt="Smiley face" height="42" width="42">'".
}

我的 HTML,

 ng-bind-html= content.answer

当我运行代码时,它显示错误

Uncaught SyntaxError: Unexpected identifier

这是我尝试过的。任何人都可以找到我的错误。谢谢。

最佳答案

试试这个:

content = {
    message: 'The best city in the world?',
    answer: 'Paris is one of the best city.<img src ="assets/paris.gif" alt="Smiley face" height="42" width="42">.'
}

关于javascript - 如何在js中将html内容添加到静态文本中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41909800/

相关文章:

php - 链式选择框 - 基本

javascript - jQuery ie输入文本问题

javascript - 从数据库中键入并计算值并在输入时显示

javascript - 在 Firefox 扩展中包含图像

javascript - 解决来自 jQuery 源的泄漏

javascript - google 图表未在 php 中使用 ajax 调用显示

html - 有没有办法设置 Netbeans HTML5 和 Web 应用程序项目?

java - 如何显示 webapps 部署文件夹之外的上传图像?

javascript - Node.js 奇怪的原型(prototype)继承

javascript - PaperJs 循环遍历路径的点位置给出 Cannot read property 'point' of undefined