SmartIT_Extensions/BMC/smart-it-full-helix/scripts/app/knowledge-article/decision-tree-description-d...

35 lines
1.4 KiB
JavaScript

"use strict";
/**
* Created by andey on 28-07-2016.
*/
(function () {
'use strict';
angular.module('knowledgeArticleModule')
.directive('decisionTreeDescription', ['$compile', function ($compile) {
return {
restrict: 'A',
scope: {
rxConfiguration: '='
},
link: function (scope, elem) {
scope.$watch('rxConfiguration', function () {
elem.html(scope.rxConfiguration && scope.rxConfiguration.description);
var anchorTags = elem.find("a"), tagIndex;
for (tagIndex = 0; tagIndex < anchorTags.length; tagIndex++) {
var anchorTag = anchorTags.eq(tagIndex);
var nextElement = anchorTag.next();
if (nextElement[0] && nextElement[0].nodeName === 'IMG') {
anchorTag.remove();
}
}
var imageTags = elem.find("img");
for (var tagIdx = 0; tagIdx < imageTags.length; tagIdx++) {
var imageTag = imageTags.eq(tagIdx);
imageTag.attr('image-toggle', '');
}
});
}
};
}]);
})();