From 7fe987ca47e33bd9ada2ad831c77e7b25d69b307 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Tue, 8 Dec 2015 19:21:41 -0600 Subject: [PATCH] Fix dynamic slides --- js/angular/directive/slides.js | 14 +++++++++++++- test/html/slides.html | 21 +++++++++++++-------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/js/angular/directive/slides.js b/js/angular/directive/slides.js index bba3a3b2492..6d5c4fa803e 100644 --- a/js/angular/directive/slides.js +++ b/js/angular/directive/slides.js @@ -54,6 +54,7 @@ function($animate, $timeout) { this.update = function() { $timeout(function() { _this.__slider.update(); + _this.__slider.createLoop(); // Don't allow pager to show with > 10 slides if (_this.__slider.slides.length > 10) { @@ -62,6 +63,14 @@ function($animate, $timeout) { }); }; + this.rapidUpdate = ionic.debounce(function() { + _this.update(); + }, 50); + + this.getSlider = function() { + return _this.__slider; + }; + var options = $scope.options || {}; var newOptions = angular.extend({ @@ -97,6 +106,9 @@ function($animate, $timeout) { require: '?^ionSlides', transclude: true, replace: true, - template: '
' + template: '
', + link: function($scope, $element, $attr, ionSlidesCtrl) { + ionSlidesCtrl.rapidUpdate(); + } }; }]); diff --git a/test/html/slides.html b/test/html/slides.html index 371596e43e8..18151d75680 100644 --- a/test/html/slides.html +++ b/test/html/slides.html @@ -16,13 +16,6 @@ Hello -

Journey to HD 219134 b

@@ -105,10 +98,22 @@

Life on HD 219134 b