在Angularjs中调用google-prettify

时间:2015-10-12 19:57:22

标签: javascript angularjs ngroute prettify

我正在尝试将Google Prettify应用于我的AngularJS代码,但它在ng-route之后正在运行。我还添加了一个美化指令,但仍面临问题:

app.directive('prettyprint', function() {
return {
    restrict: 'C',
    link: function postLink(scope, element, attrs) {
          element.html(prettyPrintOne(replaceText(element.html()),'',true));
    }
  };
});

这是关于此的Plunker:

http://plnkr.co/edit/3400Grdp5HejzKuK1sCq?p=preview

0 个答案:

没有答案