title: Can we use $sce.trustAsHtml(string) out of "filter"s?
body: <p>html:</p>
  
  <pre><code>&lt;div ng-app="app"&gt;
    &lt;test-d class="my-class"&gt;this should be replaced&lt;/test-d&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>js:</p>
  
  <pre><code>    angular.module('app', []).directive('testD', ['$compile','$sce', function($compile, $sce) {
          return {
              restrict: 'E',
              link: function(scope, element, attrs, controller) {
  
                  //"case 1"
                  //var testElement = angular.element('&lt;div class="{{testClass}}"&gt;&lt;div ng-repeat="item in items"&gt;{{item.n}}.{{item.label}}&lt;/div&gt;&lt;/div&gt;');
  
                  //"case 2"
                  var testElement = angular.element('&lt;div class="{{testClass}}"&gt;&lt;div ng-repeat="item in items"&gt;{{item.n}}&lt;div class="how-to-remove-this-div" ng-bind-html="item.label|htmlize"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;');
  
                  scope.testClass = attrs.class;
  
                  scope.items = [
                      //{n:10,label:$sce.trustAsHtml('&lt;span class="with-icon"&gt;label 11&lt;/span&gt;')},
                      // "case 1" of "testElement": no any effects (with "case 1" that would be preferred)
                      // "case 2" of "testElement": Error: [$sce:itype] Attempted to trust a non-string value in a content requiring a string: Context: html
  
                      {n:20,label:'&lt;span class="with-icon"&gt;label 22&lt;/span&gt;'},
                      {n:30,label:'&lt;span class="with-icon"&gt;label 33&lt;/span&gt;'}
                  ];
  
                  var testElementCompiled = $compile(testElement)(scope);
  
                  //"case 3"
                  element.replaceWith(testElementCompiled);
  
                  //"case 4"
                  //element.replaceWith($sce.trustAsHtml(testElementCompiled));
              }
          }
  }]).filter('htmlize', ['$sce', function($sce){
          return function(val) {
              return $sce.trustAsHtml(val);
          };
  }]);
  </code></pre>
  
  <p>jsfiddle:
  <a href="http://jsfiddle.net/isnigirev/c2wRq/" rel="noreferrer">http://jsfiddle.net/isnigirev/c2wRq/</a></p>
  
  <p>Questions: 
  1) is it possible to use trustAsHtml out of filter context ?
  2) IF NOT how to get rid of div with "how-to-remove-this-div" class in case of using "ng-bind-html" directive ?</p>