This video shows you how you an manipulate the DOM within a widget.
In this case I want to be able to click on the images to get a bigger picture in knowledge articles.
Experience nr 2 with the Link function in Service Portal widgets. Doing DOM manipulation there will affect the whole pages html, not only the widget HTML which I thought first.
to make it only on the widget, use the element in the link function:
function(scope, elem){
angular.element(document).ready(function() {
$(elem).on('click','img',function(e){
$('#modalImg').attr('src', $(this).attr('src'));
$('#imagemodal').modal('show');
});
});
}