Skip to content

Instantly share code, notes, and snippets.

@rjoydip-zz
Last active August 12, 2018 06:28
Show Gist options
  • Save rjoydip-zz/968c0d6aae34e2fd57b0bb4f807dac34 to your computer and use it in GitHub Desktop.
Save rjoydip-zz/968c0d6aae34e2fd57b0bb4f807dac34 to your computer and use it in GitHub Desktop.
.directive('imageSwap', [function() {
return {
restrict: 'EA',
link: function(scope, elem, attrs, ctrl) {
var profileMainImage = [];
var innerHtml = attrs.src;
var id = attrs.id;
if (id) {
elem.bind('click', function() {
profileMainImage['alt'] = attrs.videoUrl;
profileMainImage['src'] = innerHtml;
if (attrs.videoUrl !== undefined) scope.openVideoModal(attrs.videoUrl, attrs.id, elem.parent('div'));
if (id !== undefined) scope.reportFakeVideo(attrs.id);
if (id !== undefined) scope.reportGoodVideo(attrs.id);
});
}
}
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment