mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Fixed #424 - missing onReorder
This commit is contained in:
7
dist/js/ionic-angular.js
vendored
7
dist/js/ionic-angular.js
vendored
@@ -1495,7 +1495,12 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
link: function($scope, $element, $attr) {
|
||||
$scope.listView = new ionic.views.ListView({
|
||||
el: $element[0],
|
||||
listEl: $element[0].children[0]
|
||||
listEl: $element[0].children[0],
|
||||
onReorder: function(el, oldIndex, newIndex) {
|
||||
$scope.$apply(function() {
|
||||
$scope.onReorder({el: el, start: oldIndex, end: newIndex});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if($attr.animation) {
|
||||
|
||||
4
dist/js/ionic-angular.min.js
vendored
4
dist/js/ionic-angular.min.js
vendored
File diff suppressed because one or more lines are too long
7
js/ext/angular/src/directive/ionicList.js
vendored
7
js/ext/angular/src/directive/ionicList.js
vendored
@@ -125,7 +125,12 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
link: function($scope, $element, $attr) {
|
||||
$scope.listView = new ionic.views.ListView({
|
||||
el: $element[0],
|
||||
listEl: $element[0].children[0]
|
||||
listEl: $element[0].children[0],
|
||||
onReorder: function(el, oldIndex, newIndex) {
|
||||
$scope.$apply(function() {
|
||||
$scope.onReorder({el: el, start: oldIndex, end: newIndex});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if($attr.animation) {
|
||||
|
||||
@@ -11,6 +11,7 @@ describe('Ionic List', function() {
|
||||
}));
|
||||
|
||||
beforeEach(inject(function (_$compile_, _$rootScope_) {
|
||||
compile = _$compile_;
|
||||
scope.showDelete = false;
|
||||
scope.showReorder = false;
|
||||
|
||||
@@ -56,6 +57,22 @@ describe('Ionic List', function() {
|
||||
scope.$digest();
|
||||
expect(listElement.hasClass('item-options-hide')).toBe(true);
|
||||
});
|
||||
|
||||
it('Should reorder', function() {
|
||||
scope.onReorder = function(el, start, end) {
|
||||
};
|
||||
|
||||
listElement = angular.element('<list on-reorder="onReorder(el, start, end)"></list>');
|
||||
listElement = compile(listElement)(scope);
|
||||
|
||||
var lv = listElement.isolateScope().listView;
|
||||
|
||||
spyOn(scope, 'onReorder');
|
||||
|
||||
lv.onReorder({}, 0, 1);
|
||||
|
||||
expect(scope.onReorder).toHaveBeenCalledWith({}, 0, 1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Ionic Item Directive', function () {
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
on-refresh-holding="refreshHolding()"
|
||||
on-refresh-opening="refreshOpening(ratio)"
|
||||
on-refresh="refreshItems()"
|
||||
on-reorder="onReorder(el, start, end)"
|
||||
refresh-complete="refreshComplete"
|
||||
on-delete="deleteListItem(item)"
|
||||
delete-icon="ion-minus-circled"
|
||||
@@ -223,6 +224,9 @@
|
||||
alert('onDelete from the "list" on-delete attribute');
|
||||
$scope.items.splice($scope.items.indexOf(item), 1);
|
||||
};
|
||||
$scope.onReorder = function(el, start, end) {
|
||||
console.log('On reorder', el, start, end);
|
||||
};
|
||||
|
||||
$scope.optionButtons1 = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user