我想显示来自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/