mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Closes #1024. BREAKING CHANGE: ion-list syntax has changed in favor of simplicity & flexibility. Relevant documentation: [ionList](http://ionicframework.com/docs/api/directive/ionList), [ionItem](http://ionicframework.com/docs/api/directive/ionItem), [ionOptionButton](http://ionicframework.com/docs/api/directive/ionOptionButton), [ionReorderButton](http://ionicframework.com/docs/api/directive/ionReorderButton), [ionDeleteButton](http://ionicframework.com/docs/api/directive/ionDeleteButton), [$ionicListDelegate](http://ionicframework.com/docs/api/service/$ionicListDelegate). To migrate, change your code from this: ```html <ion-list option-buttons="[{text:'hello',type:'button-positive',onTap:tap()}]" on-delete="onDelete(el)" delete-icon="ion-minus-circled" can-delete="true" show-delete="shouldShowDelete" on-reorder="onReorder(el, startIndex, toIndex)" reorder-icon="ion-navicon" can-reorder="true" show-reorder="shouldShowReorder"> <ion-item ng-repeat="item in items"> {{item}} </ion-item> </ion-list> ``` To this: ```html <ion-list show-delete="shouldShowDelete" show-reorder="shouldShowReorder"> <ion-item ng-repeat="item in items"> {{item}} <ion-delete-button class="ion-minus-circled" ng-click="onDelete(item)"> </ion-delete-button> <ion-reorder-button class="ion-navicon" ng-click="onReorder(item, $fromIndex, $toIndex)"> </ion-reorder-button> <ion-option-button class="button-positive" ng-click="tap()"> Hello </ion-option-button> </ion-item> </ion-list> ```
51 lines
1.2 KiB
HTML
51 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<html ng-app="ionic">
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
<title></title>
|
|
|
|
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
|
|
<link rel="stylesheet" href="../../../../dist/css/ionic.css" />
|
|
<script src="../../../../dist/js/ionic.bundle.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div ng-controller="MyCtrl">
|
|
<ion-header-bar class="bar-positive">
|
|
<div class="buttons">
|
|
<button class="button button-icon icon ion-clock" ng-click="doScroll()"></button>
|
|
</div>
|
|
<h1 class="title">Click the Clock to Get Stuck</h1>
|
|
</ion-header-bar>
|
|
|
|
<ion-content class="has-header">
|
|
|
|
<ion-list>
|
|
<ion-item ng-repeat="item in items"
|
|
id="foo-{{item.id}}"
|
|
href="#/item/{{item.id}}">
|
|
Item {{ item.id }}
|
|
</ion-item>
|
|
</ion-list>
|
|
|
|
</ion-content>
|
|
</div>
|
|
|
|
<script>
|
|
function MyCtrl($scope, $location, $ionicScrollDelegate) {
|
|
$scope.items = [];
|
|
for (var i=0; i < 100; i++) {
|
|
$scope.items.push({id:i});
|
|
}
|
|
|
|
$scope.doScroll = function() {
|
|
$location.hash('foo-50');
|
|
$ionicScrollDelegate.anchorScroll(true);
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|