From 8b308a1737e29670b88c1c9fe10d137d912edbcc Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Wed, 12 Feb 2014 23:06:33 -0600 Subject: [PATCH] feat(event): Created stopEvent directive to use for certain ng-click cases, closes #550 --- js/ext/angular/src/directive/ionicList.js | 4 ++-- js/ext/angular/src/directive/ionicTouch.js | 14 +++++++++++++- js/ext/angular/test/list.html | 6 +++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/js/ext/angular/src/directive/ionicList.js b/js/ext/angular/src/directive/ionicList.js index 548bf9627e6..f3e0cf6d3bb 100644 --- a/js/ext/angular/src/directive/ionicList.js +++ b/js/ext/angular/src/directive/ionicList.js @@ -24,14 +24,14 @@ angular.module('ionic.ui.list', ['ngAnimate']) template: '
\
\ - \ + \
\ \
\ \
\
\ - \ + \
\
', diff --git a/js/ext/angular/src/directive/ionicTouch.js b/js/ext/angular/src/directive/ionicTouch.js index 8277524ddb4..ae428666dfd 100644 --- a/js/ext/angular/src/directive/ionicTouch.js +++ b/js/ext/angular/src/directive/ionicTouch.js @@ -45,7 +45,19 @@ angular.module('ionic.ui.touch', []) }; - }]); + }]) + + .directive('stopEvent', function () { + function stopEvent(e) { + e.stopPropagation(); + } + return { + restrict: 'A', + link: function (scope, element, attr) { + element.bind(attr.stopEvent, stopEvent); + } + }; + }); })(window.angular, window.ionic); diff --git a/js/ext/angular/test/list.html b/js/ext/angular/test/list.html index c3320148fc5..69a787286a7 100644 --- a/js/ext/angular/test/list.html +++ b/js/ext/angular/test/list.html @@ -109,7 +109,7 @@

List Tests

option-buttons="optionButtons1"> - +

{{item.from}}

{{item.text}}

@@ -210,6 +210,10 @@

YELLOW {{slideBox.slideIndex}}

}; + $scope.itemClick = function() { + console.debug('itemClick'); + }; + // Item Methods/Properties $scope.deleteItem = function(item) { alert('onDelete from the "item" directive on-delete attribute. Lets not delete this item today ok!');