=this.controllers.length)){var b=this.selectedController,c=this.selectedIndex;this.selectedController=this.controllers[a],this.selectedIndex=a,this._showController(a),this.tabBar.setSelectedItem(a),this.controllerChanged&&this.controllerChanged(b,c,this.selectedController,this.selectedIndex)}},_showController:function(a){for(var b,c=0,d=this.controllers.length;d>c;c++)b=this.controllers[c],b.isVisible=!1,b.visibilityChanged&&b.visibilityChanged();b=this.controllers[a],b.isVisible=!0,b.visibilityChanged&&b.visibilityChanged()},_clearSelected:function(){this.selectedController=null,this.selectedIndex=-1},getController:function(a){return this.controllers[a]},getControllers:function(){return this.controllers},getSelectedController:function(){return this.selectedController},getSelectedControllerIndex:function(){return this.selectedIndex},addController:function(a){this.controllers.push(a),this.tabBar.addItem({title:a.title,icon:a.icon}),this.selectedController||this.setSelectedController(0)},setControllers:function(a){this.controllers=a,this._clearSelected(),this.selectController(0)}})}(window.ionic);
\ No newline at end of file
diff --git a/js/ext/angular/src/directive/ionicTouch.js b/js/ext/angular/src/directive/ionicTouch.js
new file mode 100644
index 0000000000..de1d318f11
--- /dev/null
+++ b/js/ext/angular/src/directive/ionicTouch.js
@@ -0,0 +1,51 @@
+
+// Similar to Angular's ngTouch, however it uses Ionic's tap detection
+// and click simulation. ngClick
+
+(function(angular, ionic) {'use strict';
+
+
+angular.module('ionic.ui.touch', [])
+
+ .config(['$provide', function($provide) {
+ $provide.decorator('ngClickDirective', ['$delegate', function($delegate) {
+ // drop the default ngClick directive
+ $delegate.shift();
+ return $delegate;
+ }]);
+ }])
+
+ .directive('ngClick', ['$parse', function($parse) {
+
+ function onTap(e) {
+ // wire this up to Ionic's tap/click simulation
+ ionic.clickElement(e.target, e);
+ }
+
+ // Actual linking function.
+ return function(scope, element, attr) {
+
+ var clickHandler = $parse(attr.ngClick);
+
+ element.on('click', function(event) {
+ scope.$apply(function() {
+ clickHandler(scope, {$event: (event)});
+ });
+ });
+
+ ionic.on('tap', onTap, element[0]);
+
+ // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click
+ // something else nearby.
+ element.onclick = function(event) { };
+
+ scope.$on('$destroy', function () {
+ ionic.off('tap', onTap, element[0]);
+ });
+
+ };
+
+ }]);
+
+
+})(window.angular, window.ionic);
diff --git a/js/ext/angular/src/ionicAngular.js b/js/ext/angular/src/ionicAngular.js
index 2d76a56f31..2d406482ea 100644
--- a/js/ext/angular/src/ionicAngular.js
+++ b/js/ext/angular/src/ionicAngular.js
@@ -31,7 +31,8 @@ angular.module('ionic.ui', [
'ionic.ui.list',
'ionic.ui.checkbox',
'ionic.ui.toggle',
- 'ionic.ui.radio'
+ 'ionic.ui.radio',
+ 'ionic.ui.touch'
]);
diff --git a/js/ext/angular/test/clickTests.html b/js/ext/angular/test/clickTests.html
index 84d75dc2e8..01ed0fdc0e 100644
--- a/js/ext/angular/test/clickTests.html
+++ b/js/ext/angular/test/clickTests.html
@@ -9,27 +9,46 @@
-
+