1

Does anyone have experience using the angular-bootstrap-prettify.js prettyprint directive? I am having problems geting this to work. Here is my Example: http://jsfiddle.net/mjxNV/

<div ng-app>
    <div ng-controller="Ctrl1">
        <pre class="prettyprint linenums">
            <code class="lang-html">
                &lt;div class=&quot;container&quot;&gt;
                    &lt;div class=&quot;left_column&quot;&gt;
                        &lt;span&gt;Small Text&lt;/span&gt;
                    &lt;/div&gt;
                    &lt;div class=&quot;r_ightcolumn2&quot;&gt;
                        &lt;span&gt;Small Text&lt;/span&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            </code>
        </pre>
    </div>
</div>

My code is displayed but it never goes through the prettyprint tokenization. What am I doing wrong?

1
  • need to create module and inject external directive as dependency
    – charlietfl
    Apr 5, 2013 at 1:24

1 Answer 1

0

I found a sample and modify as your sample:

angular.module('app', [])
    .controller('ctrl', function($scope) { });

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

http://jsfiddle.net/yAv4f/210/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.