search

Home  >  Q&A  >  body text

node.js - angularjs中用$http服务获得的完整HTML怎么在浏览器中显示

angularjs中使用$http服务获得一个完整的HTML代码,我本意是想让这代码显示的,结果却存在浏览器中没显示,求告知怎么解决?

PHP中文网PHP中文网2787 days ago456

reply all(2)I'll reply

  • 怪我咯

    怪我咯2017-04-17 16:20:53

    In Angular, by default, assigning HTML directly to a variable and then displaying it is not trusted.

    At this time, we have to use $sce.trustAsHtml(value); to tell angular that this is trustworthy.

    For example:

    $scope.loginHtml = $sce.trustAsHtml("<h1>login.html</h1>");

    $sce also provides other methods, such as trustAsUrl, trustAsJs, etc.

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 16:20:53

    Another question that requires guessing, you deserve it.

    reply
    0
  • Cancelreply