Currently, I have a directive set up to display an image as a background image. This works perfectly fine in Chrome and Safari, but for some reason, it doesn't seem to be functioning properly in Firefox as the background images are not showing up. After doing some research, it seems like using scope.$watch may potentially help resolve this issue. However, I'm unsure of how to properly implement it in order to improve the situation.
.directive('pictures', function () {
return {
restrict: 'EA',
link: function (scope, element, attrs) {
var url = attrs.pictures;
element.css({
'background-image': 'url(' + url +')',
'background-size' : 'cover'
});
}
};
});
I would greatly appreciate any assistance or guidance on this matter. Thank you.