& nbsp;在脚本中没有被编译 [英]   in script is not getting compiled
本文介绍了& nbsp;在脚本中没有被编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在AngularJS中创建了一个应用程序,并使用过滤器在选项中添加了空格.该应用程序运行正常,但是我为空间放置的
没有得到编译.
I have created an application in AngularJS with a drop down with space in option using a filter. The application is working fine but the
which I have put for space is not getting compiled.
我的代码如下所示
JSFiddle
html
<select>
<option ng-repeat="(key, value) in headers">{{value | space}}
</option>
</select>
脚本
app.filter('space', function() {
return function(text) {
if(_.isUndefined(text.mainId))
{
console.log('entered mainId');
return text.value;
}
else
{
console.log('entered');
return ' '+text.value;
}
};
推荐答案
It works by giving the unicode value for
.
app.filter('space', function() {
return function(text) {
if(_.isUndefined(text.mainId))
{
console.log('entered mainId');
return text.value;
}
else
{
console.log('entered');
return '\u00A0\u00A0\u00A0'+text.value;
}
};
这篇关于& nbsp;在脚本中没有被编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文