Summernote insert dynamic HTML
<p>I have a variable called $scope.selectedTemplate. This variable contains HTML text and is essentially pulled from a select list filled with objects with this "content"text. </p>

<p>I am trying to then get the content to my summernote editor using a function that works when performing the first time, but not when the selectedTemplate variable is changed. When I use the same function (with a ng-bind-html) in a HTML p element the dynamic selectedTemplate content is shown.</p>

<p>This works:</p>

<pre><code>&lt;div class="shown"&gt;
    &lt;p id="templateshow" ng-bind-html="SkipValidation(selectedTemplate)"&gt;&lt;/p&gt;
&lt;/div&gt;
</code></pre>

<p>This doesn't:</p>

<pre><code>&lt;div class="editor"&gt;
    &lt;textarea class="form-control html-editor" id="templatecontent" name="content" ng-bind-html="SkipValidation(selectedTemplate)"  style="resize:none;"&gt;&lt;/textarea&gt;
&lt;/div&gt;
</code></pre>

<p><strong>AngularJS:</strong></p>

<pre><code> $scope.SkipValidation = function (value) {
    var decoded = $("&lt;p/&gt;").html(value).text();
    return $sce.trustAsHtml(decoded);
};
</code></pre>

<p><strong>Summary</strong></p>

<p>How can I, using the ng-bind-html and SkipValidation method, dynamically change the HTML formatted content of my Summernote editor?</p>

<p><strong>Update 1:</strong></p>

<p>Trying to handle a change of selectedTemplate using a watch is working with the following code:</p>

<pre><code>$scope.$watch('selectedTemplate', function() {
    if($scope.selectedTemplate != ""){
       $("#templatecontent").summernote('code',"&lt;b&gt;Hello&lt;/b&gt;");    
    }
});
</code></pre>

<p>However, this is manual and static text which outputs <strong>Hello</strong>.</p>

<p>Using this code, unfortunately, does not work:</p>

<pre><code>$scope.$watch('selectedTemplate', function() {
    if($scope.selectedTemplate != ""){
        $("#templatecontent").summernote('code',$scope.SkipValidation($scope.selectedTemplate));    
    }
});
</code></pre>