SmartIT_Extensions/BMC/smart-it-full-helix/scripts/app/knowledge-article/toggle-knowledge-article-pr...

21 lines
774 B
JavaScript

"use strict";
(function () {
'use strict';
//pass to a directive the value of selected article, when it exist - the preview will be shown
angular.module('knowledgeArticleModule')
.directive('toggleKnowledgeArticlePreview', [function () {
return {
restrict: 'A',
scope: {
article: '=toggleKnowledgeArticlePreview'
},
link: function (scope, element) {
var kaOpenedClass = 'ka-preview-opened';
scope.$watch('article', function (article) {
(article) ? element.addClass(kaOpenedClass) : element.removeClass(kaOpenedClass);
});
}
};
}]);
}());