- var app = angular.module('plunker',['ngSanitize']);
- app.directive('toHtml',function() {
- return {
- restrict: 'A',link: function (scope,el,attrs) {
- el.html(scope.$eval(attrs.toHtml));
- }
- };
- });
- 使用方法:
- <p to-html="name"></p>
- var app = angular.module('plunker',['ngSanitize']);
- app.directive('toHtml',function() {
- return {
- restrict: 'A',link: function (scope,el,attrs) {
- el.html(scope.$eval(attrs.toHtml));
- }
- };
- });
- 使用方法:
- <p to-html="name"></p>