Files
ionic-framework/js/ext/angular/test/sideMenu.html
2014-03-09 17:44:00 -05:00

80 lines
2.6 KiB
HTML

<html ng-app="sideMenuTest">
<head>
<meta charset="utf-8">
<title>Side Menus</title>
<!-- Sets initial viewport load and disables zooming -->
<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="MenuCtrl">
<ion-side-menus>
<ion-pane ion-side-menu-content>
<header class="bar bar-header bar-assertive">
<button class="button button-icon ion-navicon" ng-click="openLeft()"></button>
<h1 class="title">Slide me</h1>
<button class="button button-icon ion-navicon" ng-click="openRight()"></button>
</header>
<ion-content has-header="true">
<ion-toggle ng-model="$root.$draggy">Hello</ion-toggle>
<input type="range" ng-model="$root.menuWidth" min="0" max="300">
<h1>Content</h1>
</ion-content>
</ion-pane>
<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 has-header="true">
<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-assertive">
<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.list = [];
for(var i = 0; i < 20; i++) {
$scope.list.push({
text: 'Item ' + i
});
}
$scope.openLeft = function() {
$ionicSideMenuDelegate.toggleLeft($scope);
};
$scope.openRight = function() {
$ionicSideMenuDelegate.toggleRight($scope);
};
})
.controller('LeftCtrl', function($scope) {
$scope.value = true;
$scope.list = [{text:1},{text:2},{text:3}];
});
</script>
</body>
</html>