Here is my Markup
<div ng-app="myApp" ng-controller="myCtrl">
<input type="text" ng-model="name">
<p ng-bind-html="myText|unsafe"></p>
</div>
I am using this code
var app = angular.module("myApp", ['ngSanitize']);
app.controller("myCtrl", function($scope) {
$scope.myText = "My name is: <h1>{{name}}</h1>";
$scope.name="Habib";
});
app.filter('unsafe', function ($sce) {
return function(val) {
return $sce.trustAsHtml(val);
};
});
Output:
My name is: {{}}
Desired Output:
My name is: Habib
I want it should also reflect value from textbox.