angularjs中使用$http服务获得一个完整的HTML代码,我本意是想让这代码显示的,结果却存在浏览器中没显示,求告知怎么解决?
认证高级PHP讲师
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.
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:
$sce also provides other methods, such as trustAsUrl, trustAsJs, etc.
Another question that requires guessing, you deserve it.