How to render html with AngularJS templates

后端 未结 5 712
遥遥无期
遥遥无期 2020-11-27 15:31

This is my template:

a

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 16:15

    To do this, I use a custom filter.

    In my app:

    myApp.filter('rawHtml', ['$sce', function($sce){
      return function(val) {
        return $sce.trustAsHtml(val);
      };
    }]);
    

    Then, in the view:

    {{ stuff.title}}

提交回复
热议问题