angular-swiper
angular-swiper copied to clipboard
Resize issue when used with $http call
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?
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.
Did you guys try override-parameters ? There is observer property, try setting it to true.