UNPKG

zettapi_client

Version:

Admin panel and client-side CRUD operations in angular to use with zettapi_server rest api to get started quickly in any CMS project.

19 lines 678 B
app.directive('checkImage', function($http) { return { restrict: 'A', link: function(scope, element, attrs) { attrs.$observe('ngSrc', function(ngSrc) { if (!ngSrc) { element.attr('src', attrs.imgDefault); // set default image } else { $http.get(ngSrc).then(function() { //alert('image exist'); }).catch(function() { //alert('image not exist'); element.attr('src', attrs.imgDefault); // set default image }); } }); } }; });