javascript - Using HTML Tags received from Api call in AngularJS -
i receive element rest api. follows:
" hyderabad adventure & trekker's club (hat's) "
the above written bold text b tags.
it coming is(with b tags written separately) want content under tag should bold in html , there line break.
try work :
var app = angular.module('myapp',[]); app.controller('examplecontroller', ['$scope','$sce', function($scope,$sce) { $scope.myhtml = $sce.trustashtml("<b>hyderabad adventure & trekker's club (hat's)</b>"); }]);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script> <div ng-app="myapp"> <div ng-controller="examplecontroller"> <span ng-bind-html="myhtml"></span> </div> </div>
Comments
Post a Comment