2015-12-18 3 views

ответ

2

Да это, есть пример в AngularJS Documentation:

Контроллер:

angular.module('bindHtmlExample', ['ngSanitize']) 
    .controller('ExampleController', ['$scope', function($scope) { 
     $scope.myHTML = 'I am an <code>HTML</code>string with ' + '<a href="#">links!</a> and other <em>stuff</em>'; 
}]); 

HTML:

<div ng-controller="ExampleController"> 
    <p ng-bind-html="myHTML"></p> 
</div> 

Выход:

<div ng-controller="ExampleController"> 
    <p>I am an <code>HTML</code>string with ' + '<a href="#">links!</a> and other <em>stuff</em></p> 
</div> 
Смежные вопросы