【问题标题】:Removing the unwanted signs in asp.net using Json使用 Json 删除 asp.net 中不需要的符号
【发布时间】:2014-07-31 07:28:25
【问题描述】:

实际上我试图删除输出中的 html 不需要的元素,例如 " , ' 等...

这是我在脚本标签中使用的代码

scope.categorywithouthtml = function () {
        return sce.trustAsHtml(scope.directories.dirurl);
        return sce.trustAsHtml(scope.directories.text);
    };

这是我要在 dirurltext

中删除的代码
<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}} 的地方,输出不应有 " , . ' 等。

【问题讨论】:

    标签: javascript asp.net json angularjs


    【解决方案1】:

    我不完全确定您要做什么,但我想指出您的第二个退货声明永远不会在这里:

    scope.categorywithouthtml = function () {
        return sce.trustAsHtml(scope.directories.dirurl);//This exits the function
        return sce.trustAsHtml(scope.directories.text);//This line is never reached
    };
    

    【讨论】:

    • 如果我单独给出第一行,那么应该让输出知道,但它没有显示结果
    【解决方案2】:

    试试这个代码。

    scope.categorywithouthtml = function () {
    return sce.trustAsHtml(scope.directories.dirurl);
    };
    

    那么就给出这段代码,但是一个条件是你一次只能得到一个值,循环值是行不通的。

    <span ng-bind-html="categorywithouthtml()"></span>
    

    【讨论】:

      猜你喜欢
      • 2016-08-19
      • 1970-01-01
      • 2013-04-17
      • 1970-01-01
      • 2022-01-23
      • 1970-01-01
      • 1970-01-01
      • 2014-09-05
      相关资源
      最近更新 更多