Tag Archives: Manual load Prismjs

Angular js – Calling a function when ng-repeat is finished

I had to call the SyntaxHighlighter/Prismjs to reload once the angularjs loading data is finished. I took some time to figure it out, but finally I found a StackOverflow post which helped me to fix this.

   $scope.$watch("posts", function (value) {
                            //  var pr = new prism();
                            //  pr.load();
                            $timeout(function () {
                                Prism.highlightAll();
                                SyntaxHighlighter.highlight();
                            });
                        });

One can manually load prism syntax and SyntaxHighlighter to apply their syntaxes after the data is loaded
for prism use

  Prism.highlightAll(asyn,callback);

and for SyntaxHighlighter it was eash

  SyntaxHighlighter.highlight();