I'm calling a API that returns HTML, containing some code
tags.
I'm looking forward to decorate that element with a directive, but as the HTML is coming from the API, I unable to add an directive attribute.
Angular decorates elements such as form
with directives so I though about doing something like that:
angular.module('myApp')
.directive('code', function($log) {
return {
restrict: 'E',
link: function(scope, element, attrs) {
$log.info('Code Directive');
}
};
});
Although the console log did not print. Am I missing something?
EDIT: I notice that the log works with code
elements that are created before the API call. However when the API injects the code into the html, the directive doesn't run. Is there a way to manually make it run?