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> ```
89 lines
2.7 KiB
HTML
89 lines
2.7 KiB
HTML
<html ng-app="sideMenuTest">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Side Menus</title>
|
|
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
|
|
<link rel="stylesheet" href="../../../../dist/css/ionic.css">
|
|
<script src="../../../../dist/js/ionic.bundle.js"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<div ng-controller="MenuCtrl">
|
|
|
|
<ion-side-menus>
|
|
|
|
<ion-side-menu-content>
|
|
<header class="bar bar-header bar-positive">
|
|
<button class="button button-icon ion-navicon" ng-click="toggleLeft()"></button>
|
|
<h1 class="title">Slide me</h1>
|
|
<button class="button button-icon ion-navicon" ng-click="toggleRight()"></button>
|
|
</header>
|
|
<ion-content class="has-header">
|
|
<ion-toggle ng-model="$root.$draggy">Hello</ion-toggle>
|
|
<input type="range" ng-model="$root.menuWidth" min="0" max="300">
|
|
<h1>Content</h1>
|
|
<ion-list>
|
|
<ion-item>
|
|
Sup
|
|
<ion-option-button class="button-positive">Hello</ion-option-button>
|
|
</ion-item>
|
|
</ion-list>
|
|
</ion-content>
|
|
</ion-side-menu-content>
|
|
|
|
<ion-side-menu side="left" width="$root.menuWidth || 270" ng-controller="LeftCtrl">
|
|
<header class="bar bar-header bar-assertive">
|
|
<h1 class="title">Left</h1>
|
|
</header>
|
|
<ion-content class="has-header">
|
|
<h3>value = {{value}}</h3>
|
|
<ul class="list">
|
|
<a href="#" class="item" ng-repeat="item in list">
|
|
{{item.text}}
|
|
</a>
|
|
</ul>
|
|
</ion-content>
|
|
</ion-side-menu>
|
|
|
|
<ion-side-menu side="right">
|
|
<header class="bar bar-header bar-royal">
|
|
<h1 class="title">Right</h1>
|
|
</header>
|
|
<ion-content>
|
|
<ul class="list">
|
|
<a href="#" class="item" ng-repeat="item in list">
|
|
{{item.text}}
|
|
</a>
|
|
</ul>
|
|
</ion-content>
|
|
</ion-side-menu>
|
|
|
|
</ion-side-menus>
|
|
|
|
</div>
|
|
<script>
|
|
angular.module('sideMenuTest', ['ionic'])
|
|
|
|
.controller('MenuCtrl', function($scope, $ionicSideMenuDelegate) {
|
|
|
|
$scope.toggleLeft = $ionicSideMenuDelegate.toggleLeft;
|
|
$scope.toggleRight = $ionicSideMenuDelegate.toggleRight;
|
|
|
|
$scope.list = [];
|
|
for(var i = 0; i < 20; i++) {
|
|
$scope.list.push({
|
|
text: 'Item ' + i
|
|
});
|
|
}
|
|
})
|
|
|
|
.controller('LeftCtrl', function($scope) {
|
|
$scope.value = true;
|
|
$scope.list = [{text:1},{text:2},{text:3}];
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|