【发布时间】:2014-01-31 15:32:33
【问题描述】:
我正在尝试美化一些动态生成的文本。
<div ng-app="Knob" ng-controller="myCtrl">
<pre class="prettyprint">{{text}}</pre>
</div>
var App = angular.module('Knob', []);
App.controller('myCtrl', function($scope) {
$scope.text = "hello world";
})
App.directive('prettyprint', function() {
return {
restrict: 'C',
link: function postLink(scope, element, attrs) {
prettyPrint();
}
};
});
输出:
hello worldtext}}
有什么想法吗?
【问题讨论】:
标签: angularjs google-code-prettify