Files
ionic-framework/js/ext/angular/test/navAndTabs.html
2013-11-19 15:51:04 -06:00

150 lines
4.7 KiB
HTML

<html ng-app="navTest">
<head>
<meta charset="utf-8">
<title>Nav Bars And Tabs</title>
<!-- Sets initial viewport load and disables zooming -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<link href="/vendor/font-awesome/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="../../../../dist/css/ionic.css">
<script src="../../../../dist/js/ionic.js"></script>
<script src="../../../../dist/js/ionic-angular.js"></script>
</head>
<body>
<pane nav-router animation="slide-left-right">
<nav-bar class="nav-title-slide-ios7" type="bar-positive" back-button-type="button-icon" back-button-icon="icon ion-arrow-left-c"></nav-bar>
<ng-view></ng-view>
</pane>
<script id="page1.html" type="text/ng-template">
<nav-page hide-back-button="true">
<tabs tabs-style="tabs-icon-top" tabs-type="tabs-positive">
<!-- Pets tab -->
<tab title="Pets" icon="icon ion-home" ng-controller="PetsCtrl">
<content has-header="true" has-tabs="true">
<list>
<link-item ng-repeat="pet in pets" type="item-text-wrap" href="#/pet/{{pet.id}}">
<h3>{{pet.title}}</h3>
<p>{{pet.description}}</p>
</item>
</link-item>
</list>
</content>
</tab>
<!-- Adoption tab -->
<tab title="Adopt" icon="icon ion-heart" ng-controller="AdoptCtrl" right-buttons="buttons">
<content has-header="true" has-tabs="true">
<div class="padding">
<h2>Adopt a pet today.</h2>
</div>
<div class="list list-inset">
<label class="item item-input">
<span class="input-label">Your name</span>
<input type="text">
</label>
<label class="item item-input">
<span class="input-label">Your email</span>
<input type="password">
</label>
<label class="item item-input">
<textarea placeholder="Any more info?"></textarea>
</label>
<button class="button button-positive button-block">Adopt</button>
</div>
</content>
</tab>
<!-- Home tab -->
<tab title="About" icon="icon ion-search">
<content has-header="true" has-tabs="true" padding="true">
<h3>About this app</h3>
<p>
This is a sample seed project for the Ionic Framework. Please change it to match your needs.
</p>
</content>
</tab>
</tabs>
</nav-page>
</script>
<script id="pet.html" type="text/ng-template">
<nav-page title="pet.title" ng-controller="PetCtrl">
</nav-page>
</script>
<script id="page2.html" type="text/ng-template">
<nav-page title="'Beets'">
<h1>Page 2</h1>
<a class="button button-pure" nav-back>Back</a>
<a class="button button-assertive" href="#/page3">Next</a>
</nav-page>
</script>
<script id="page3.html" type="text/ng-template">
<nav-page title="'Battlestar Galactica'">
<h1>Page 3</h1>
<a class="button button-pure" nav-back>Back</a>
</nav-page>
</script>
<script>
angular.module('navTest', ['ionic'])
.config(function($routeProvider, $locationProvider) {
$routeProvider.when('/', {
templateUrl: 'page1.html',
controller: 'Page1Ctrl'
});
$routeProvider.when('/page2', {
templateUrl: 'page2.html',
});
$routeProvider.when('/page3', {
templateUrl: 'page3.html',
});
$routeProvider.when('/pet/:petId', {
templateUrl: 'pet.html',
controller: 'PetCtrl'
});
// configure html5 to get links working on jsfiddle
//$locationProvider.html5Mode(true);
})
.controller('Page1Ctrl', function($scope) {
$scope.num = Math.floor(Math.random() * 100);
})
.controller('PetsCtrl', function($scope, $routeParams) {
$scope.pets = [
{ id: 1, title: 'Cat', description: 'Furry little feline' }
];
})
.controller('PetCtrl', function($scope, $routeParams) {
$scope.pet = {
title: 'Cat'
}
})
.controller('AdoptCtrl', function($scope) {
$scope.buttons = [
{
text: 'Adopt',
tap: function(e) {
console.log('ADOPT TAPPED');
},
type: 'button-clear'
}
];
});
</script>
</body>
</html>