Skip to content

Commit

Permalink
docs(ionicSlideBox): add documentation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ajoslin committed Mar 11, 2014
1 parent fe2dcdc commit 1dd5527
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
8 changes: 4 additions & 4 deletions js/ext/angular/src/directive/ionicSlideBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {});
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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) {
Expand Down
44 changes: 42 additions & 2 deletions js/views/sliderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
*
*/

/**
* @ngdoc controller
* @name ionicSlideBox
* @module ionic
* @description
* Controller for the {@link ionic.directive:ionTabs ionTabs} directive.
*/

(function(ionic) {
'use strict';

Expand Down Expand Up @@ -465,38 +473,70 @@ 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();

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();

prev();
};

/**
* @ngdoc method
* @name ionicSlideBox#next
* @description Go to the next slide. Wraps around if at the end.
*/
this.next = function() {
// cancel slideshow
stop();

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;
};
Expand Down

0 comments on commit 1dd5527

Please sign in to comment.