From f78c8d5484a7e03b2b6587e9547ccaea6e0fe490 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Fri, 7 Dec 2018 14:24:18 -0500 Subject: #757 trap image load and re-generate connkey --- www/js/app.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index 604912a0..9ca20c8e 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -488,12 +488,13 @@ angular.module('zmApp', [ // This directive is adapted from https://github.com/paveisistemas/ionic-image-lazy-load // I've removed lazyLoad and only made it show a spinner when an image is loading //-------------------------------------------------------------------------------------------- - .directive('imageSpinnerSrc', ['$document', '$compile', 'imageLoadingDataShare', '$timeout', - function ($document, $compile, imageLoadingDataShare, $timeout) { + .directive('imageSpinnerSrc', ['$document', '$compile', 'imageLoadingDataShare', '$timeout', '$parse', + function ($document, $compile, imageLoadingDataShare, $timeout, $parse) { return { restrict: 'A', scope: { - imageSpinnerBackgroundImage: "@imageSpinnerBackgroundImage" + imageSpinnerBackgroundImage: "@imageSpinnerBackgroundImage", + imageOnError: '&' }, link: function ($scope, $element, $attributes) { @@ -519,7 +520,7 @@ angular.module('zmApp', [ // show an image-missing image $element.bind('error', function () { - // console.log ("DIRECTIVE: IMAGE ERROR"); + loader.remove(); @@ -556,6 +557,16 @@ angular.module('zmApp', [ // $element.prop('data-src', hurl); imageLoadingDataShare.set(0); + + if ($attributes.imageOnError) { + //console.log (">>>> ERROR CBK"); + $scope.imageOnError(); + // fn($scope, {}); + } + else { + //console.log (">>>>>>>>>> NO ERROR CBK"); + } + }); function waitForFrame1() { -- cgit v1.2.3