你能把字符串中的数字变量加粗并在 html 中表示为 UI 吗?

Can you bold a number variable in a string and express it the UI when placed in the html?

我有以下情况:

Javascript:

var aNumber = 17;
var problem = "Is there a way to bold a number like this: "+aNumber+"?";

HTML:

<ion-item>{{problem}}</ion-item>

我得到: 有没有办法像这样加粗数字:17?

我想要: 有没有办法像这样加粗数字:17?

我尝试在变量 aNumber 周围的问题变量中使用 <b></b><strong></strong>

这看起来像:

var problem = "Is there a way to bold a number like this: "<strong>+aNumber+</strong>"?";

不,那也没用。

我还尝试了以下方法:

var aNumber = 17;
var problem = "Is there a way to bold a number like this: "

HTML:

<ion-item>{{problem}}{{aNumber}}?</ion-item>

此答案仅显示问题变量: 有没有办法像这样加粗数字:

不确定<ion-item>但是根据问题中提到的标签,这样做:

var aNumber = 17;
var problem = "Is there a way to bold a number like this: <strong>" + aNumber + "</strong>?";

document.getElementById('output').innerHTML = problem;
<div id="output"></div>