Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript AngularJS ng绑定html不使用表达式_Javascript_Html_Angularjs - Fatal编程技术网

Javascript AngularJS ng绑定html不使用表达式

Javascript AngularJS ng绑定html不使用表达式,javascript,html,angularjs,Javascript,Html,Angularjs,我试图在ng bind html中计算一个表达式,但它不起作用。如果有人知道这方面的解决方法,请帮助 下面的代码没有显示任何内容 <h5 ng-bind-html="{{feedType ==='popularProducts' ? displayedProduct.title : displayedProduct.name}}"></h5> 指令ngBindHtml要求属性值作为表达式,因此不需要{{}插值。只需删除这些大括号,即可将表达式直接传递给指令 工作语法:

我试图在ng bind html中计算一个表达式,但它不起作用。如果有人知道这方面的解决方法,请帮助

下面的代码没有显示任何内容

<h5 ng-bind-html="{{feedType ==='popularProducts' ? displayedProduct.title : displayedProduct.name}}"></h5>

指令
ngBindHtml
要求属性值作为表达式,因此不需要
{{}
插值。只需删除这些大括号,即可将表达式直接传递给指令

工作语法:

<h5 ng-bind-html="feedType === 'popularProducts' ? displayedProduct.title : displayedProduct.name"></h5>


适用的AngularJS

您是否在控制台中收到任何错误,并且您是否确定ng bind html将在{{}中计算表达式?我试过小提琴,但{{}本身没有得到评价。。你能用更多关于控制器细节的信息或者你为什么在这里使用ng bind html来更新小提琴吗?{{}没有使用ng bind html标记。这就是我为什么要求解决的原因。我使用ng bind html,因为内容包含一些符号代码,这些代码由html转换,比如registed/TM符号代码。明白了。你能检查一下这是否有帮助吗?不,我不应该添加任何类型的控制器。我所能做的就是用angularjs指令更改标记。