Join the Stack Overflow Community
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I have an input data such like that:

<p>His dream is to study medicine, &nbsp;{_}?</p>

The character {_} make the output for ng-bind-html not give any output at all.

How to solve this problem?

You may refer this fiddle for your extra information.

share|improve this question

If you include the angular-sanitize script, inputs are sanitized by parsing the HTML into tokens

var miAp = angular.module('miAp', ['ngSanitize']);

miAp.controller('demoController', function($scope) {
     $scope.bar = "<p>His dream is to study medicine, &nbsp;{_}?</p>";
  });
<html>

<head>
  <meta charset="utf-8">
  <title>ngBind</title>
  
  <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular.min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.1/angular-sanitize.min.js" type="text/javascript"></script>
  
  <script src="cookies.js"></script>
</head>

<body ng-app="miAp" ng-controller="demoController">
   <div ng-bind-html="bar"></div>
</body>

</html>

share|improve this answer
    
Thanks for the answer..I want to try first. – Imran yesterday
    
did it work for you? – Sajeetharan yesterday
    
Take sometimes to run ionic android..wait yea – Imran yesterday
    
I think is all ok, ngBindHtml requires the ngSanitize module. Simply that. – Lenilson de Castro yesterday
    
How to appy in ionic? I paste it as you do..but It does not work to me. – Imran yesterday

You can't assign raw text as HTML. you need a conversion. $sce.trustAsHtml used to convert the raw text to HTMl. Here is the link.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.