[英]AngularJS v1.4.2 ng-bind-html and ng-bind-html-unsafe don't work
[英]ng-bind-html and ng-bind-html-unsafe is not working?
首先,我正在使用angular.1.3.0。 那我有
<td class="vcenter" >{{data.videos}}</td>
它可以工作,但可以對html進行編碼。 然后我嘗試了
<td class="vcenter" ng-bind-html="data.videos"></td>
但是它什么也沒顯示。 然后我嘗試了
<td class="vcenter" ng-bind-html-unsafe="data.videos"></td>
它也什么也沒顯示。 我缺少什么?
請檢查以下工作示例: http : //jsfiddle.net/Shital_D/b9qtj56p/6/
下載文件-angular-sanitize.js並將其包含在您的應用程序中。
var app = angular.module('myApp', ["ngSanitize"]);
app.controller('myController', function($scope,$compile) {
$scope.html = '<p>Your html code</p>';
});
<div ng-app="myApp">
<div ng-controller="myController">
<p ng-bind-html="html"></p>
</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.