in脚本未被编译
in script is not getting compiled
我在AngularJS中创建了一个应用程序,其中有一个下拉菜单,选项中有空格,使用了一个过滤器。应用程序运行良好,但我为空间放置的
没有得到编译。
我的代码如下所示
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;
}
};
它通过为
提供unicode值来工作。
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;
}
};
从这里回答
像这样尝试return ''u00A0' + text.value;
Javascript不知道您想要解析html实体,这就是为什么我们必须使用unicode代码。
工作小提琴
相关文章:
- 浏览器是否持久缓存脚本元素的编译版本
- 使用脚本#编译代码(独立)
- 如何在删除脚本后刷新/重新编译dom中的脚本
- 使用NPM和Watchify编译多个脚本包
- in脚本未被编译
- 为什么这个咖啡脚本没有编译“;正确”;
- 让浏览器获取源代码并重新编译脚本以进行实时编辑
- 浏览器中常用脚本的预编译版本
- 节点应用程序自动重新加载,自动编译咖啡脚本和自动编译更少的css
- 咖啡脚本错误编译
- 编译咖啡脚本
- “尝试在清除的范围内运行编译和运行脚本” - 使用 Google Graph API 在 Drupal 中出错
- 使用npm脚本部分的webpack来编译es6
- Firefox控制台错误:试图在清除的范围内运行编译并执行脚本
- Babel Transforms不编译脚本
- 在Java编译的脚本中调用Javascript函数's编写API脚本
- Coffee脚本编译错误
- R.js不能正确编译模糊脚本
- 在Node脚本中加载预编译的把手栏模板
- 准备脚本在JavaScript编译器中编译(Google Closure)