Skip to content

Commit

Permalink
added currentSlide to scope models
Browse files Browse the repository at this point in the history
  • Loading branch information
abrbhat committed Dec 26, 2015
1 parent 0411ce4 commit 48e7f21
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/angular-swiper.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions src/angular-swiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
slideCls: '@',
direction: '@',
swiper: '=',
overrideParameters: '='
overrideParameters: '=',
currentSlide: '='
},
controller: function($scope, $element, $timeout) {
var uuid = createUUID();
Expand Down Expand Up @@ -100,6 +101,12 @@
swiper = new Swiper($element[0].firstChild, params);
}

if(!angular.isUndefined($scope.currentSlide)){
swiper.on('transitionEnd', function(){
$scope.currentSlide = Math.abs(swiper.progress);
});
}

//If specified, calls this function when the swiper object is available
if (!angular.isUndefined($scope.onReady)) {
$scope.onReady({
Expand Down Expand Up @@ -155,4 +162,4 @@
};
}

})(window, angular, undefined);
})(window, angular, undefined);

0 comments on commit 48e7f21

Please sign in to comment.