Skip to content

Commit 1dd5527

Browse files
committed
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.
1 parent fe2dcdc commit 1dd5527

File tree

2 files changed

+46
-6
lines changed

2 files changed

+46
-6
lines changed

Diff for: js/ext/angular/src/directive/ionicSlideBox.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ angular.module('ionic.ui.slideBox', [])
6565
continuous: continuous,
6666
startSlide: $scope.activeSlide,
6767
slidesChanged: function() {
68-
$scope.currentSlide = slider.getPos();
68+
$scope.currentSlide = slider.currentIndex();
6969

7070
// Try to trigger a digest
7171
$timeout(function() {});
@@ -102,8 +102,8 @@ angular.module('ionic.ui.slideBox', [])
102102

103103
$ionicSlideBoxDelegate.register($scope, $element);
104104

105-
this.getNumSlides = function() {
106-
return slider.getNumSlides();
105+
this.slidesCount = function() {
106+
return slider.slidesCount();
107107
};
108108

109109
$timeout(function() {
@@ -158,7 +158,7 @@ angular.module('ionic.ui.slideBox', [])
158158
};
159159

160160
$scope.numSlides = function() {
161-
return new Array(slideBox.getNumSlides());
161+
return new Array(slideBox.slidesCount());
162162
};
163163

164164
$scope.$watch('currentSlide', function(v) {

Diff for: js/views/sliderView.js

+42-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
*
77
*/
88

9+
/**
10+
* @ngdoc controller
11+
* @name ionicSlideBox
12+
* @module ionic
13+
* @description
14+
* Controller for the {@link ionic.directive:ionTabs ionTabs} directive.
15+
*/
16+
917
(function(ionic) {
1018
'use strict';
1119

@@ -465,38 +473,70 @@ ionic.views.Slider = ionic.views.View.inherit({
465473
setup();
466474
};
467475

476+
/**
477+
* @ngdoc method
478+
* @name ionicSlideBox#slide
479+
* @param {number} to The index to slide to.
480+
* @param {number=} speed The number of milliseconds for the change to take.
481+
*/
468482
this.slide = function(to, speed) {
469483
// cancel slideshow
470484
stop();
471485

472486
slide(to, speed);
473487
};
474488

489+
/**
490+
* @ngdoc method
491+
* @name ionicSlideBox#prev
492+
* @description Go to the previous slide. Wraps around if at the beginning.
493+
*/
475494
this.prev = function() {
476495
// cancel slideshow
477496
stop();
478497

479498
prev();
480499
};
481500

501+
/**
502+
* @ngdoc method
503+
* @name ionicSlideBox#next
504+
* @description Go to the next slide. Wraps around if at the end.
505+
*/
482506
this.next = function() {
483507
// cancel slideshow
484508
stop();
485509

486510
next();
487511
};
488512

513+
/**
514+
* @ngdoc method
515+
* @name ionicSlideBox#stop
516+
* @description Stop sliding. The slideBox will not move again until
517+
* explicitly told to do so.
518+
*/
489519
this.stop = function() {
490520
// cancel slideshow
491521
stop();
492522
};
493523

494-
this.getPos = function() {
524+
/**
525+
* @ngdoc method
526+
* @name ionicSlideBox#currentIndex
527+
* @returns {number} index The index of the current slide.
528+
*/
529+
this.currentIndex = function() {
495530
// return current index position
496531
return index;
497532
};
498533

499-
this.getNumSlides = function() {
534+
/**
535+
* @ngdoc method
536+
* @name ionicSlideBox#slidesCount
537+
* @returns {number} count The number of slides there are currently.
538+
*/
539+
this.slidesCount = function() {
500540
// return total number of slides
501541
return length;
502542
};

0 commit comments

Comments
 (0)