Ng-bind-html对HTML标签不能正常工作



我已经遵循了这个主题

它工作!从这个

<p>9+555</p>rn

到此<p>9+555</p>

仍然会留下HTML标签。

我怎样才能使这些标签工作为HTML而不是文本。非常感谢

您不应该使用&lt和&gt,您应该直接编写<p>

angular.module('bindHtmlExample', ['ngSanitize'])
    .controller('ExampleController', ['$scope', function($scope) {
        $scope.myHTML = 'I am an <code>HTML</code>string with ' +
                        '<a href="#">links!</a> and other <em>stuff</em>';
    }]);

这是一个显示字符串和正确html格式字符串之间差异的标签http://plnkr.co/edit/RZmuzTilvBkU3oGUre7J

最新更新