Nurul Alam Anik Nurul Alam Anik - 3 months ago 10
AngularJS Question

AngularJS data bind shows html

When i attach a scope variable to a div it displays html tags. Trying to solve it.

Controller



$scope.homeBox = response.data[$item];


<div ng-bind="homeBox" ng-bind-html="myService.body | limitTo: limit"></div>


This displays following
enter image description here

Answer

Use ng-bind-html if you have to bind html

<div ng-bind-html="homeBox" ng-bind-html="myService.body | limitTo: limit"></div>

But you cannot have two ng-bind-html in one tag. First one will dominate. So better use separate div for both.

Comments