实际上,我尝试删除输出中不需要的 html 元素,例如 "、 '
等...
这是我的脚本标记中使用的代码
scope.categorywithouthtml = function () {
return sce.trustAsHtml(scope.directories.dirurl);
return sce.trustAsHtml(scope.directories.text);
};
这是我要在 dirurl 和 text 中删除的代码
<span" ng-bind-html="categorywithouthtml()" "{{dir.dirurl}}"></span>
<a href= "{{dir.dirurl}}" class="button1" rel="{{dir.text}}">
我用span删除了它,我错过了什么吗?
<a href= "{{dir.dirurl}}" class="button1" rel="{{dir.text}}">
在 {{dir.dirurl}} 的位置,输出不应包含 "、 . ' 等。
最佳答案
我不完全确定您要做什么,但我想指出您的第二个返回语句永远不会在这里到达:
scope.categorywithouthtml = function () {
return sce.trustAsHtml(scope.directories.dirurl);//This exits the function
return sce.trustAsHtml(scope.directories.text);//This line is never reached
};
关于javascript - 使用 Json 删除 ASP.NET 中不需要的符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25053099/