I'm using AngularJS v1.4.2 and like to print out html from a variable in the $scope.
I tried to use ng-bind-html and ng-bind-html-unsafe but both are not working.
Here is my controller:
var ctrl = angular.module('app.ctrl',['app.model'])
.controller('Controller',function($scope, $log, Model){
$log.warn("controller für View wurde erstellt");
$log.log(Model.getValue());
$scope.sayHello="Hello World!";
$scope.sayHelloHtml="<strong>Hello World Fett</strong>";
});
And my HTML code:
...
<div ng-controller="Controller">Meine erste angularJS View {{ sayHello }}
<div ng-bind="sayHello"></div>
<div ng-bind-html="sayHelloHtml"></div>
</div>
...
$sceto trust your HTML content. see docs.angularjs.org/api/ng/service/$sce