Angularjs display field as html -
this question has answer here:
i have a field contains html. when display using {{field}} html not rendered. how display field rendered html? customform.description contains html:
<h4>work requests</h4> <div ng-repeat="customforms in customformgroups" class="row"> <div ng-repeat="customform in customforms" class="col-sm-4"> <strong>{{customform.name}}</strong> <p>{{customform.description}}</p> <div class="form-group"> <a class="btn btn-primary" href="javascript:void(0);" ng-click="selectservice(customform)">select</a> </div> </div> </div>
use $sce
service display html. create function in controller return trusted html:
$scope.displaysafehtml = function(html){ return $sce.trustashtml(html); }
then use ng-bind-html
function:
<p ng-bind-html="displaysafehtml(customform.description)"></p>
Comments
Post a Comment