mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
docs(ionicSlideBox): add documentation
Some methods were renamed solely to make the phrasing be the same across the entire project (abbreviations versus not, and tabbar uses index wording while this used position). BREAKING CHANGE: ionicSlideBox#getPos has been renamed to ionicSlideBox#currentIndex. ionicSlideBox#numSlides has been renamed to ionicSlideBox#slidesCount.
This commit is contained in:
@@ -65,7 +65,7 @@ angular.module('ionic.ui.slideBox', [])
|
||||
continuous: continuous,
|
||||
startSlide: $scope.activeSlide,
|
||||
slidesChanged: function() {
|
||||
$scope.currentSlide = slider.getPos();
|
||||
$scope.currentSlide = slider.currentIndex();
|
||||
|
||||
// Try to trigger a digest
|
||||
$timeout(function() {});
|
||||
@@ -102,8 +102,8 @@ angular.module('ionic.ui.slideBox', [])
|
||||
|
||||
$ionicSlideBoxDelegate.register($scope, $element);
|
||||
|
||||
this.getNumSlides = function() {
|
||||
return slider.getNumSlides();
|
||||
this.slidesCount = function() {
|
||||
return slider.slidesCount();
|
||||
};
|
||||
|
||||
$timeout(function() {
|
||||
@@ -158,7 +158,7 @@ angular.module('ionic.ui.slideBox', [])
|
||||
};
|
||||
|
||||
$scope.numSlides = function() {
|
||||
return new Array(slideBox.getNumSlides());
|
||||
return new Array(slideBox.slidesCount());
|
||||
};
|
||||
|
||||
$scope.$watch('currentSlide', function(v) {
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ngdoc controller
|
||||
* @name ionicSlideBox
|
||||
* @module ionic
|
||||
* @description
|
||||
* Controller for the {@link ionic.directive:ionTabs ionTabs} directive.
|
||||
*/
|
||||
|
||||
(function(ionic) {
|
||||
'use strict';
|
||||
|
||||
@@ -465,6 +473,12 @@ ionic.views.Slider = ionic.views.View.inherit({
|
||||
setup();
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name ionicSlideBox#slide
|
||||
* @param {number} to The index to slide to.
|
||||
* @param {number=} speed The number of milliseconds for the change to take.
|
||||
*/
|
||||
this.slide = function(to, speed) {
|
||||
// cancel slideshow
|
||||
stop();
|
||||
@@ -472,6 +486,11 @@ ionic.views.Slider = ionic.views.View.inherit({
|
||||
slide(to, speed);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name ionicSlideBox#prev
|
||||
* @description Go to the previous slide. Wraps around if at the beginning.
|
||||
*/
|
||||
this.prev = function() {
|
||||
// cancel slideshow
|
||||
stop();
|
||||
@@ -479,6 +498,11 @@ ionic.views.Slider = ionic.views.View.inherit({
|
||||
prev();
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name ionicSlideBox#next
|
||||
* @description Go to the next slide. Wraps around if at the end.
|
||||
*/
|
||||
this.next = function() {
|
||||
// cancel slideshow
|
||||
stop();
|
||||
@@ -486,17 +510,33 @@ ionic.views.Slider = ionic.views.View.inherit({
|
||||
next();
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name ionicSlideBox#stop
|
||||
* @description Stop sliding. The slideBox will not move again until
|
||||
* explicitly told to do so.
|
||||
*/
|
||||
this.stop = function() {
|
||||
// cancel slideshow
|
||||
stop();
|
||||
};
|
||||
|
||||
this.getPos = function() {
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name ionicSlideBox#currentIndex
|
||||
* @returns {number} index The index of the current slide.
|
||||
*/
|
||||
this.currentIndex = function() {
|
||||
// return current index position
|
||||
return index;
|
||||
};
|
||||
|
||||
this.getNumSlides = function() {
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name ionicSlideBox#slidesCount
|
||||
* @returns {number} count The number of slides there are currently.
|
||||
*/
|
||||
this.slidesCount = function() {
|
||||
// return total number of slides
|
||||
return length;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user