angular-swiper icon indicating copy to clipboard operation
angular-swiper copied to clipboard

Resize issue when used with $http call

Open sirMuffles91 opened this issue 9 years ago • 2 comments

Good day. I am using angular-swiper in an Ionic application. I have noticed that there is an issue when loading images from an external source and then repeating them. The carousel opens with the main image and only starts working as expected when the page resizes? It seems that the slider initialises before the images have loaded. I followed an example that suggests to create a directive:

.directive('imageonload', function ($rootScope) {
    return {
    restrict: 'A',
        link: function(scope, element, attrs) {
        element.bind('load', function() {
                    $rootScope.swiper.updateSlidesSize();

            });


        }
    };
});

however I keep getting 'Uncaught TypeError: Cannot read property 'updateSlidesSize' of undefined' so not too sure how to fix the issue?

sirMuffles91 avatar Jan 06 '16 10:01 sirMuffles91

This directive doesn't bind the swiper instance to the $rootScope, but to the isolated scope of the directive. You should be able to invoke the method through scope.swiper.updateSlidesSize(), if your directive's scope is referencing the angular-swiper directive scope.

brh55 avatar Jan 06 '16 15:01 brh55

Did you guys try override-parameters ? There is observer property, try setting it to true.

sergegl avatar Mar 05 '16 20:03 sergegl