diff --git a/js/ext/angular/src/controller/ionicScrollController.js b/js/ext/angular/src/controller/ionicScrollController.js index 07d3937b03..41c870f27a 100644 --- a/js/ext/angular/src/controller/ionicScrollController.js +++ b/js/ext/angular/src/controller/ionicScrollController.js @@ -10,7 +10,7 @@ angular.module('ionic.ui.scroll') * {@link ionic.directive:ionScroll} directives). * * Methods called directly on the $ionicScrollDelegate service will control all scroll - * views. Use the {@link ionic.service:$ionicScrollDelegate#getByHandle getByHandle} + * views. Use the {@link ionic.service:$ionicScrollDelegate#$getByHandle $getByHandle} * method to control specific scrollViews. * * @usage @@ -50,10 +50,10 @@ angular.module('ionic.ui.scroll') * ```js * function MainCtrl($scope, $ionicScrollDelegate) { * $scope.scrollMainToTop = function() { - * $ionicScrollDelegate.getByHandle('mainScroll').scrollTop(); + * $ionicScrollDelegate.$getByHandle('mainScroll').scrollTop(); * }; * $scope.scrollSmallToTop = function() { - * $ionicScrollDelegate.getByHandle('small').scrollTop(); + * $ionicScrollDelegate.$getByHandle('small').scrollTop(); * }; * } * ``` @@ -125,7 +125,7 @@ angular.module('ionic.ui.scroll') * ``` * ```js * function ScrollCtrl($scope, $ionicScrollDelegate) { - * var delegate = $ionicScrollDelegate.getByHandle('myScroll'); + * var delegate = $ionicScrollDelegate.$getByHandle('myScroll'); * * // Put any unique ID here. The point of this is: every time the controller is recreated * // we want to load the correct remembered scroll values. @@ -161,12 +161,12 @@ angular.module('ionic.ui.scroll') 'scrollToRememberedPosition' /** * @ngdoc method - * @name $ionicScrollDelegate#getByHandle + * @name $ionicScrollDelegate#$getByHandle * @param {string} handle * @returns `delegateInstance` A delegate instance that controls only the * scrollViews with `delegate-handle` matching the given handle. * - * Example: `$ionicScrollDelegate.getByHandle('my-handle').scrollTop();` + * Example: `$ionicScrollDelegate.$getByHandle('my-handle').scrollTop();` */ ])) diff --git a/js/ext/angular/src/directive/ionicNavBar.js b/js/ext/angular/src/directive/ionicNavBar.js index 5ae03f25c3..432b65d667 100644 --- a/js/ext/angular/src/directive/ionicNavBar.js +++ b/js/ext/angular/src/directive/ionicNavBar.js @@ -7,6 +7,25 @@ angular.module('ionic.ui.navBar', ['ionic.service.view', 'ngSanitize']) * @module ionic * @description * Delegate for controlling the {@link ionic.directive:ionNavBar} directive. + * + * @usage + * + * ```html + * + * + * + * + * + * ``` + * ```js + * function MyCtrl($scope, $ionicNavBarDelegate) { + * $scope.setNavTitle = function(title) { + * $ionicNavBarDelegate.setTitle(title); + * } + * } + * ``` */ .service('$ionicNavBarDelegate', delegateService([ /** @@ -20,7 +39,7 @@ angular.module('ionic.ui.navBar', ['ionic.service.view', 'ngSanitize']) * @ngdoc method * @name $ionicNavBarDelegate#align * @description Aligns the title with the buttons in a given direction. - * @param {string=} direction The direction to the align the title text towards. + * @param {string=} direction The direction to the align the title text towards. * Available: 'left', 'right', 'center'. Default: 'center'. */ 'align', @@ -28,7 +47,7 @@ angular.module('ionic.ui.navBar', ['ionic.service.view', 'ngSanitize']) * @ngdoc method * @name $ionicNavBarDelegate#showBackButton * @description - * Set whether the {@link ionic.directive:ionNavBackButton} should be shown + * Set whether the {@link ionic.directive:ionNavBackButton} should be shown * (if it exists). * @param {boolean} show Whether to show the back button. */ @@ -73,10 +92,12 @@ angular.module('ionic.ui.navBar', ['ionic.service.view', 'ngSanitize']) 'getPreviousTitle' /** * @ngdoc method - * @name $ionicNavBarDelegate#getByHandle + * @name $ionicNavBarDelegate#$getByHandle * @param {string} handle * @returns `delegateInstance` A delegate instance that controls only the * navBars with delegate-handle matching the given handle. + * + * Example: `$ionicNavBarDelegate.$getByHandle('myHandle').setTitle('newTitle')` */ ])) diff --git a/js/ext/angular/src/directive/ionicSideMenu.js b/js/ext/angular/src/directive/ionicSideMenu.js index 456c03eab0..c29f0890cb 100644 --- a/js/ext/angular/src/directive/ionicSideMenu.js +++ b/js/ext/angular/src/directive/ionicSideMenu.js @@ -29,7 +29,7 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture', 'ionic.service.vie * Delegate for controlling the {@link ionic.directive:ionSideMenus} directive. * * Methods called directly on the $ionicSideMenuDelegate service will control all side - * menus. Use the {@link ionic.service:$ionicSideMenuDelegate#getByHandle getByHandle} + * menus. Use the {@link ionic.service:$ionicSideMenuDelegate#$getByHandle $getByHandle} * method to control specific ionSideMenus instances. * * @usage @@ -96,13 +96,13 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture', 'ionic.service.vie 'canDragContent', /** * @ngdoc method - * @name $ionicSideMenuDelegate#getByHandle + * @name $ionicSideMenuDelegate#$getByHandle * @param {string} handle * @returns `delegateInstance` A delegate instance that controls only the * {@link ionic.directive:ionSideMenus} directives with `delegate-handle` matching * the given handle. * - * Example: `$ionicSideMenuDelegate.getByHandle('my-handle').toggleLeft();` + * Example: `$ionicSideMenuDelegate.$getByHandle('my-handle').toggleLeft();` */ ])) diff --git a/js/ext/angular/src/directive/ionicSlideBox.js b/js/ext/angular/src/directive/ionicSlideBox.js index ced645eb80..80288a9d66 100644 --- a/js/ext/angular/src/directive/ionicSlideBox.js +++ b/js/ext/angular/src/directive/ionicSlideBox.js @@ -11,8 +11,34 @@ angular.module('ionic.ui.slideBox', []) * Delegate that controls the {@link ionic.directive:ionSlideBox} directive. * * Methods called directly on the $ionicSlideBoxDelegate service will control all side - * menus. Use the {@link ionic.service:$ionicSlideBoxDelegate#getByHandle getByHandle} + * menus. Use the {@link ionic.service:$ionicSlideBoxDelegate#$getByHandle $getByHandle} * method to control specific slide box instances. + * + * @usage + * + * ```html + * + * + * + *
+ * + *
+ *
+ * + *
+ * Slide 2! + *
+ *
+ *
+ * + * ``` + * ```js + * function MyCtrl($scope, $ionicSlideBoxDelegate) { + * $scope.nextSlide = function() { + * $ionicSlideBoxDelegate.next(); + * } + * } + * ``` */ .service('$ionicSlideBoxDelegate', delegateService([ /** @@ -63,13 +89,13 @@ angular.module('ionic.ui.slideBox', []) 'slidesCount' /** * @ngdoc method - * @name $ionicSlideBoxDelegate#getByHandle + * @name $ionicSlideBoxDelegate#$getByHandle * @param {string} handle * @returns `delegateInstance` A delegate instance that controls only the * {@link ionic.directive:ionSlideBox} directives with `delegate-handle` matching * the given handle. * - * Example: `$ionicSlideBoxDelegate.getByHandle('my-handle').stop();` + * Example: `$ionicSlideBoxDelegate.$getByHandle('my-handle').stop();` */ ])) diff --git a/js/ext/angular/src/directive/ionicTabBar.js b/js/ext/angular/src/directive/ionicTabBar.js index a08c0f30e6..fbcc318c4e 100644 --- a/js/ext/angular/src/directive/ionicTabBar.js +++ b/js/ext/angular/src/directive/ionicTabBar.js @@ -15,8 +15,31 @@ angular.module('ionic.ui.tabs', ['ionic.service.view']) * Delegate for controlling the {@link ionic.directive:ionTabs} directive. * * Methods called directly on the $ionicTabsDelegate service will control all ionTabs - * directives. Use the {@link ionic.service:$ionicTabsDelegate#getByHandle getByHandle} + * directives. Use the {@link ionic.service:$ionicTabsDelegate#$getByHandle $getByHandle} * method to control specific ionTabs instances. + * + * @usage + * + * ```html + * + * + * + * + * Hello tab 1! + * + * + * Hello tab 2! + * + * + * + * ``` + * ```js + * function MyCtrl($scope, $ionicTabsDelegate) { + * $scope.selectTabWithIndex = function(index) { + * $ionicTabsDelegate.select(index); + * } + * } + * ``` */ .service('$ionicTabsDelegate', delegateService([ /** @@ -34,19 +57,19 @@ angular.module('ionic.ui.tabs', ['ionic.service.view']) 'select', /** * @ngdoc method - * @name $ionicTabsDelegate#selectedTabIndex + * @name $ionicTabsDelegate#selectedIndex * @returns `number` The index of the selected tab, or -1. */ 'selectedIndex' /** * @ngdoc method - * @name $ionicTabsDelegate#getByHandle + * @name $ionicTabsDelegate#$getByHandle * @param {string} handle * @returns `delegateInstance` A delegate instance that controls only the * {@link ionic.directive:ionTabs} directives with `delegate-handle` matching * the given handle. * - * Example: `$ionicTabsDelegate.getByHandle('my-handle').select(0);` + * Example: `$ionicTabsDelegate.$getByHandle('my-handle').select(0);` */ ])) @@ -55,7 +78,7 @@ angular.module('ionic.ui.tabs', ['ionic.service.view']) var self = this; self.tabs = []; - self.selectedTabIndex = function() { + self.selectedIndex = function() { return self.tabs.indexOf(_selectedTab); }; self.selectedTab = function() { diff --git a/js/ext/angular/src/service/delegateService.js b/js/ext/angular/src/service/delegateService.js index 7cc5993efa..2d141a84c7 100644 --- a/js/ext/angular/src/service/delegateService.js +++ b/js/ext/angular/src/service/delegateService.js @@ -18,7 +18,7 @@ function delegateService(methodNames) { }; }; - this.getByHandle = function(handle) { + this.$getByHandle = function(handle) { if (!handle) { return delegate; } @@ -29,11 +29,11 @@ function delegateService(methodNames) { * Creates a new object that will have all the methodNames given, * and call them on the given the controller instance matching given * handle. - * The reason we don't just let getByHandle return the controller instance + * The reason we don't just let $getByHandle return the controller instance * itself is that the controller instance might not exist yet. * * We want people to be able to do - * `var instance = $ionicScrollDelegate.getByHandle('foo')` on controller + * `var instance = $ionicScrollDelegate.$getByHandle('foo')` on controller * instantiation, but on controller instantiation a child directive * may not have been compiled yet! * diff --git a/js/ext/angular/test/directive/ionicTabBar.unit.js b/js/ext/angular/test/directive/ionicTabBar.unit.js index 4f1e40dc4e..f30520a957 100644 --- a/js/ext/angular/test/directive/ionicTabBar.unit.js +++ b/js/ext/angular/test/directive/ionicTabBar.unit.js @@ -23,15 +23,15 @@ describe('tabs', function() { })); it('.getTabIndex should return indexOf tab', function() { - expect(ctrl.selectedTabIndex()).toBe(-1); + expect(ctrl.selectedIndex()).toBe(-1); var tab1 = {}, tab2 = {}; ctrl.add(tab1); ctrl.add(tab2); - expect(ctrl.selectedTabIndex()).toBe(0); + expect(ctrl.selectedIndex()).toBe(0); ctrl.select(tab2); - expect(ctrl.selectedTabIndex()).toBe(1); + expect(ctrl.selectedIndex()).toBe(1); ctrl.deselect(tab2); - expect(ctrl.selectedTabIndex()).toBe(-1); + expect(ctrl.selectedIndex()).toBe(-1); }); it('.add should add tab and select if empty, & set historyId', inject(function($ionicViewService) { diff --git a/js/ext/angular/test/rememberScroll.html b/js/ext/angular/test/rememberScroll.html index 9a8aca1990..3897da5fb3 100644 --- a/js/ext/angular/test/rememberScroll.html +++ b/js/ext/angular/test/rememberScroll.html @@ -19,7 +19,7 @@