mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(ionList): clean up code
This commit is contained in:
36
js/angular/directive/itemOptionButton.js
vendored
36
js/angular/directive/itemOptionButton.js
vendored
@@ -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);
|
||||
};
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
4
js/angular/directive/list.js
vendored
4
js/angular/directive/list.js
vendored
@@ -74,8 +74,8 @@
|
||||
*/
|
||||
IonicModule
|
||||
.directive('ionList', [
|
||||
'$animate',
|
||||
'$timeout',
|
||||
'$animate',
|
||||
'$timeout',
|
||||
function($animate, $timeout) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
|
||||
Reference in New Issue
Block a user