chore(ionList): clean up code

This commit is contained in:
Andrew Joslin
2014-05-15 07:30:30 -06:00
parent 09d1197acd
commit 462ef38f44
2 changed files with 22 additions and 18 deletions

View File

@@ -29,21 +29,25 @@ var ITEM_TPL_OPTION_BUTTONS =
*/
IonicModule
.directive('ionOptionButton', ['$compile', function($compile) {
return {
restrict: 'E',
require: '^ionItem',
priority: Number.MAX_VALUE,
compile: function($element, $attr) {
$attr.$set('class', ($attr['class'] || '') + ' button', true);
return function($scope, $element, $attr, itemCtrl) {
if (!itemCtrl.optionsContainer) {
itemCtrl.optionsContainer = jqLite(ITEM_TPL_OPTION_BUTTONS);
itemCtrl.$element.append(itemCtrl.optionsContainer);
}
itemCtrl.optionsContainer.append($element);
$element.on('click', eventStopPropagation);
};
function stopPropagation(e) {
e.stopPropagation();
}
};
return {
restrict: 'E',
require: '^ionItem',
priority: Number.MAX_VALUE,
compile: function($element, $attr) {
$attr.$set('class', ($attr['class'] || '') + ' button', true);
return function($scope, $element, $attr, itemCtrl) {
if (!itemCtrl.optionsContainer) {
itemCtrl.optionsContainer = jqLite(ITEM_TPL_OPTION_BUTTONS);
itemCtrl.$element.append(itemCtrl.optionsContainer);
}
itemCtrl.optionsContainer.append($element);
//Don't bubble click up to main .item
$element.on('click', stopPropagation);
};
}
};
}]);

View File

@@ -74,8 +74,8 @@
*/
IonicModule
.directive('ionList', [
'$animate',
'$timeout',
'$animate',
'$timeout',
function($animate, $timeout) {
return {
restrict: 'E',