Angular filter to pass HTML string


Hi, how can I do a angular filter, to read a string html , or how do I create a method to read a string html

<div ng-bind-html="item.description"></div>

why when I save text with

he saves it but he shows me the html tags

<div class="des-img_gal-pre" ng-show="item.have_description">
      <div ng-bind-html="item.description"></div>
asked by Edison Sarmiento 27.03.2018 в 18:57

1 answer


You could use the directive ngBindHtml .

var app = angular.module("myApp", ['ngSanitize']);
app.controller("myCtrl", function($scope) {
    $scope.myText = "Mi nombre es: <h1>Carlos :)</h1>";
<script src=""></script>
<script src="//"></script>

<div ng-app="myApp" ng-controller="myCtrl">

    <p ng-bind-html="myText"></p>


Note: This example includes the " angular-sanitize.js ", which has   Functions to remove potentially dangerous HTML tokens

answered by 28.03.2018 в 02:54