UNPKG

ionic-cordova-gulp-seed

Version:

Ionic & Cordova & Gulp seed with organized code, tests, bower support and some other stuff. Originated from ionic-angular-cordova-seed.

49 lines (42 loc) 1.19 kB
IonicModule .config(['$provide', function($provide) { $provide.decorator('ngClickDirective', ['$delegate', function($delegate) { // drop the default ngClick directive $delegate.shift(); return $delegate; }]); }]) /** * @private */ .factory('$ionicNgClick', ['$parse', function($parse) { return function(scope, element, clickExpr) { var clickHandler = angular.isFunction(clickExpr) ? clickExpr : $parse(clickExpr); element.on('click', function(event) { scope.$apply(function() { clickHandler(scope, {$event: (event)}); }); }); // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click // something else nearby. element.onclick = function(event) { }; }; }]) .directive('ngClick', ['$ionicNgClick', function($ionicNgClick) { return function(scope, element, attr) { $ionicNgClick(scope, element, attr.ngClick); }; }]) .directive('ionStopEvent', function() { return { restrict: 'A', link: function(scope, element, attr) { element.bind(attr.ionStopEvent, eventStopPropagation); } }; }); function eventStopPropagation(e) { e.stopPropagation(); }