My Angular directive seems to have trouble working with dynamically loaded elements via AJAX.
Check out my code below:
var HighlightCode = angular.module('HighlightCode', []).directive('highlight', function() { //No I18N
return {
restrict: 'A',
link: function(scope, element, attrs) {
// Highlight code logic here
}
}
});
When I use the directive like this, it works fine:
<p class="descriptionPara" highlight ngbind-html="parseDesc(p)" ></p>
However, it doesn't work as expected when I try to use it like this:
<p class="descriptionPara" ngbind-html="parseDesc(p)" >
<pre highlight> elements </pre> // loaded via AJAX in parseDesc(p)
</p>