mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
Delete item works
This commit is contained in:
8
dist/ionic-angular.js
vendored
8
dist/ionic-angular.js
vendored
@ -189,7 +189,7 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
transclude: true,
|
||||
template: '<li class="list-item">' +
|
||||
' <div class="list-item-edit" ng-if="item.canDelete">' +
|
||||
' <button class="button button-icon"><i ng-class="deleteIcon"></i></button>' +
|
||||
' <button class="button button-icon" ng-click="deleteClicked()"><i ng-class="deleteIcon"></i></button>' +
|
||||
' </div>' +
|
||||
' <div class="list-item-content" ng-transclude>' +
|
||||
' </div>' +
|
||||
@ -198,9 +198,15 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
' </div>' +
|
||||
'</li>',
|
||||
link: function($scope, $element, $attr) {
|
||||
// Triggered when a button is clicked
|
||||
$scope.buttonClicked = function(button) {
|
||||
button.buttonClicked && button.buttonClicked($scope.item);
|
||||
}
|
||||
|
||||
// Triggered when the delete item is clicked
|
||||
$scope.deleteClicked = function() {
|
||||
$scope.item.deleteItem && $scope.item.deleteItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
25
dist/ionic.js
vendored
25
dist/ionic.js
vendored
@ -1780,41 +1780,32 @@ window.ionic = {
|
||||
;
|
||||
(function(ionic) {
|
||||
|
||||
/**
|
||||
* The ListView handles a list of items. It will process drag animations, edit mode,
|
||||
* and other operations that are common on mobile lists or table views.
|
||||
*/
|
||||
ionic.views.List = function(opts) {
|
||||
var _this = this;
|
||||
|
||||
this.el = opts.el;
|
||||
|
||||
this.dragThresholdX = 10;
|
||||
// The amount of dragging required to start sliding the element over (in pixels)
|
||||
this.dragThresholdX = opts.dragThresholdX || 10;
|
||||
|
||||
// Start the drag states
|
||||
this._initDrag();
|
||||
|
||||
// Listen for drag and release events
|
||||
window.ionic.onGesture('drag', function(e) {
|
||||
_this._handleDrag(e);
|
||||
}, this.el);
|
||||
window.ionic.onGesture('release', function(e) {
|
||||
_this._handleEndDrag(e);
|
||||
}, this.el);
|
||||
|
||||
/*
|
||||
window.ionic.onGesture('swipeleft', function(e) {
|
||||
_this._handleSwipeLeft(e);
|
||||
e.gesture.stopDetect();
|
||||
return false;
|
||||
}, this.el);
|
||||
|
||||
window.ionic.onGesture('swiperight', function(e) {
|
||||
_this._handleSwipeRight(e);
|
||||
e.gesture.stopDetect();
|
||||
return false;
|
||||
}, this.el);
|
||||
*/
|
||||
};
|
||||
|
||||
ionic.views.List.prototype = {
|
||||
_initDrag: function() {
|
||||
this._offsetX = 0;
|
||||
this._deltaSlowX = null;
|
||||
this._isDragging = false;
|
||||
this._currentDrag = null;
|
||||
},
|
||||
|
||||
8
js/ext/angular/src/directive/ionicList.js
vendored
8
js/ext/angular/src/directive/ionicList.js
vendored
@ -7,7 +7,7 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
transclude: true,
|
||||
template: '<li class="list-item">' +
|
||||
' <div class="list-item-edit" ng-if="item.canDelete">' +
|
||||
' <button class="button button-icon"><i ng-class="deleteIcon"></i></button>' +
|
||||
' <button class="button button-icon" ng-click="deleteClicked()"><i ng-class="deleteIcon"></i></button>' +
|
||||
' </div>' +
|
||||
' <div class="list-item-content" ng-transclude>' +
|
||||
' </div>' +
|
||||
@ -16,9 +16,15 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
' </div>' +
|
||||
'</li>',
|
||||
link: function($scope, $element, $attr) {
|
||||
// Triggered when a button is clicked
|
||||
$scope.buttonClicked = function(button) {
|
||||
button.buttonClicked && button.buttonClicked($scope.item);
|
||||
}
|
||||
|
||||
// Triggered when the delete item is clicked
|
||||
$scope.deleteClicked = function() {
|
||||
$scope.item.deleteItem && $scope.item.deleteItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -104,6 +104,7 @@
|
||||
canSwipe: true,
|
||||
icon: 'icon-chevron-right',
|
||||
hide: false,
|
||||
deleteItem: removeItem,
|
||||
buttons: [{
|
||||
text: 'Kill',
|
||||
type: 'button-danger',
|
||||
@ -115,6 +116,7 @@
|
||||
canDelete: true,
|
||||
canSwipe: true,
|
||||
icon: 'icon-chevron-right',
|
||||
deleteItem: removeItem,
|
||||
buttons: [{
|
||||
text: 'Kill',
|
||||
type: 'button-danger',
|
||||
@ -126,6 +128,7 @@
|
||||
canDelete: true,
|
||||
canSwipe: true,
|
||||
icon: 'icon-chevron-right',
|
||||
deleteItem: removeItem,
|
||||
buttons: [{
|
||||
text: 'Kill',
|
||||
type: 'button-danger',
|
||||
@ -137,6 +140,7 @@
|
||||
canDelete: true,
|
||||
canSwipe: true,
|
||||
icon: 'icon-chevron-right',
|
||||
deleteItem: removeItem,
|
||||
buttons: [{
|
||||
text: 'Kill',
|
||||
type: 'button-danger',
|
||||
|
||||
@ -1,40 +1,31 @@
|
||||
(function(ionic) {
|
||||
|
||||
/**
|
||||
* The ListView handles a list of items. It will process drag animations, edit mode,
|
||||
* and other operations that are common on mobile lists or table views.
|
||||
*/
|
||||
ionic.views.List = function(opts) {
|
||||
var _this = this;
|
||||
|
||||
this.el = opts.el;
|
||||
|
||||
this.dragThresholdX = 10;
|
||||
// The amount of dragging required to start sliding the element over (in pixels)
|
||||
this.dragThresholdX = opts.dragThresholdX || 10;
|
||||
|
||||
// Start the drag states
|
||||
this._initDrag();
|
||||
|
||||
// Listen for drag and release events
|
||||
window.ionic.onGesture('drag', function(e) {
|
||||
_this._handleDrag(e);
|
||||
}, this.el);
|
||||
window.ionic.onGesture('release', function(e) {
|
||||
_this._handleEndDrag(e);
|
||||
}, this.el);
|
||||
|
||||
/*
|
||||
window.ionic.onGesture('swipeleft', function(e) {
|
||||
_this._handleSwipeLeft(e);
|
||||
e.gesture.stopDetect();
|
||||
return false;
|
||||
}, this.el);
|
||||
|
||||
window.ionic.onGesture('swiperight', function(e) {
|
||||
_this._handleSwipeRight(e);
|
||||
e.gesture.stopDetect();
|
||||
return false;
|
||||
}, this.el);
|
||||
*/
|
||||
};
|
||||
|
||||
ionic.views.List.prototype = {
|
||||
_initDrag: function() {
|
||||
this._offsetX = 0;
|
||||
this._deltaSlowX = null;
|
||||
this._isDragging = false;
|
||||
this._currentDrag = null;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user