One thing I came accross, is that using directives to manipulate content and to attach jQuery plugins is a much more sophisticated way and more generic to do.
As I was facing this problem right now, here's my (browserified) directive:
/**
* A slimscroll.js directive
*
* Requires Slimscroll.js
*
* @type {exports}
*/
exports = module.exports = function (ngModule) {
ngModule.directive('slimscroll', function ($parse) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
height = angular.element(element).css('height');
angular.element(element).slimScroll(
{
size: '7px',
color: ($(this).attr("data-handle-color") ? $(this).attr("data-handle-color") : '#a1b2bd'),
railColor: ($(this).attr("data-rail-color") ? $(this).attr("data-rail-color") : '#333'),
position: 'right',
height: height,
alwaysVisible: ($(this).attr("data-always-visible") == "1" ? true : false),
railVisible: ($(this).attr("data-rail-visible") == "1" ? true : false),
disableFadeOut: true
}
);
}
}
})
}