From 4d793fd9f488310100f310f1cc8f9e41d2ebeb68 Mon Sep 17 00:00:00 2001 From: Andrew Joslin Date: Tue, 20 May 2014 08:23:11 -0600 Subject: [PATCH] demo(ionList): add demos --- js/angular/directive/list.js | 148 +++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/js/angular/directive/list.js b/js/angular/directive/list.js index 69e0905f20..c5577151c2 100644 --- a/js/angular/directive/list.js +++ b/js/angular/directive/list.js @@ -72,6 +72,154 @@ * @param can-swipe {boolean=} Whether the items in the list are allowed to be swiped to reveal * option buttons. Default: true. */ +/** + * @ngdoc demo + * @name ionList#everything + * @module listEverything + * @javascript + * angular.module('listEverything', ['ionic']) + * .controller('ListCtrl', function($scope, $ionicPopup) { + * $scope.data = { + * showReorder: false, + * showDelete: false + * }; + * + * $scope.items = []; + * for (var i = 0; i < 20; i++) { + * $scope.items.push(i); + * } + * + * $scope.toggleDelete = function() { + * $scope.data.showReorder = false; + * $scope.data.showDelete = !$scope.data.showDelete; + * }; + * $scope.toggleReorder = function() { + * $scope.data.showDelete = false; + * $scope.data.showReorder = !$scope.data.showReorder; + * }; + * + * $scope.share = function(item) { + * alert('Sharing ' + item); + * }; + * $scope.edit = function(item) { + * alert('Editing ' + item); + * }; + * + * $scope.reorderItem = function(item, fromIndex, toIndex) { + * $scope.items.splice(fromIndex, 1) + * $scope.items.splice(toIndex, 0, item) + * }; + * }); + * + * @html + *
+ * + * + * Delete + * + *

List

+ * + * Reorder + * + *
+ * + * + * + * + * + *

Item {{item}}

+ *

Here's an item description.

+ * + * Share + * + * + * Edit + * + * + * + * + * + * + *
+ *
+ *
+ *
+ */ +/** + * @ngdoc demo + * @name ionList#animated + * @module listAnimated + * @javascript + * angular.module('listAnimated', ['ionic']) + * .controller('AnimatedListCtrl', function($scope, $timeout) { + * var nextItem = 0; + * $scope.items = []; + * for (var i=0; i < 5; i++) { + * $scope.items.push('Item ' + (nextItem++)); + * } + * + * $scope.addItem = function(atIndex) { + * $scope.items.splice(atIndex + 1, 0, 'Item ' + nextItem); + * nextItem++; + * }; + * }); + * + * @html + *
+ * + *

Animated List

+ *
+ * + * + * + * + * {{item}} + * + * + * + * + * + *
+ * + * @css + * .animated-item .item-note .button { + * margin-top: 10px; + * } + * .animated-item { + * line-height: 52px; + * padding-top: 0; + * padding-bottom: 0; + * -webkit-transition: all 0.15s linear; + * -moz-transition: all 0.15s linear; + * transition: all 0.15s linear; + * } + * .animated-item.ng-leave.ng-leave-active, + * .animated-item.ng-enter { + * opacity: 0; + * max-height: 0; + * } + * .animated-item.ng-leave, + * .animated-item.ng-enter.ng-enter-active { + * opacity: 1; + * max-height: 52px; + * } + */ IonicModule .directive('ionList', [ '$animate',