node.js - angularjs中用$http服务获得的完整HTML怎么在浏览器中显示
PHP中文网
PHP中文网 2017-04-17 16:18:53
0
2
450

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

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
刘奇

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.

巴扎黑

Another question that requires guessing, you deserve it.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template