td {
border: 1px solid #FF0000;
}
Snippet:
Directive | How | Source | Rendered |
ng-bind-html | Automatically uses $sanitize | ||
ng-bind-html | Bypass $sanitize by explicitly trusting the dangerous value |
t;/div> | |
ng-bind | Automatically escapes |
angular.module('app', ['ngSanitize']);
function Ctrl($scope, $sce) {
$scope.snippet =
'
an html\n' +
'click here\n' +
'snippet
';$scope.deliberatelyTrustDangerousSnippet = function () {
return $sce.trustAsHtml($scope.snippet);
};
}
一键复制
编辑
Web IDE
原始数据
按行查看
历史