在Angularjs显示html文本,如果按照一般处理它。它只能页中显示没经解释文本。

在ASP.NET MVC添加一个控制器:
ASP.NET MVC下使用AngularJs语言(八):显示html

创建angularjs控制器:
ASP.NET MVC下使用AngularJs语言(八):显示html

 

pilotApp.controller('ShowHtmlCtrl', ['$scope','$sce',
    function ($scope, $sce) {
        var htmltext = "Hello <span style = 'color:red'><b>Insus.NET</b></span>";
        $scope.Content = $sce.trustAsHtml(htmltext);
    }]
);
Source Code

相关文章:

  • 2021-08-29
  • 2021-10-03
  • 2021-10-25
  • 2022-12-23
  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-13
  • 2021-08-15
  • 2021-07-25
  • 2022-01-23
  • 2022-02-03
  • 2021-12-07
  • 2021-10-05
相关资源
相似解决方案