|
| 1 | +<html ng-app="navTest"> |
| 2 | + <head> |
| 3 | + <meta charset="utf-8"> |
| 4 | + <title>Nav Bars</title> |
| 5 | + |
| 6 | + <!-- Sets initial viewport load and disables zooming --> |
| 7 | + <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> |
| 8 | + <link rel="stylesheet" href="../../../../dist/css/ionic.css"> |
| 9 | + <script src="../../../../dist/js/ionic.js"></script> |
| 10 | + <script src="../../../../dist/js/angular/angular.js"></script> |
| 11 | + <script src="../../../../dist/js/angular/angular-animate.js"></script> |
| 12 | + <script src="../../../../dist/js/angular/angular-route.js"></script> |
| 13 | + <script src="../../../../dist/js/angular/angular-touch.js"></script> |
| 14 | + <script src="../../../../dist/js/angular/angular-sanitize.js"></script> |
| 15 | + <script src="../../../../dist/js/ionic-angular.js"></script> |
| 16 | + </head> |
| 17 | + <body> |
| 18 | + <pane nav-router animation="slide-left-right"> |
| 19 | + <nav-bar animation="nav-title-slide-ios7" type="bar-positive" back-button-type="button-icon" back-button-icon="icon ion-arrow-left-c"></nav-bar> |
| 20 | + <ng-view></ng-view> |
| 21 | + </pane> |
| 22 | + |
| 23 | + <script id="page1.html" type="text/ng-template"> |
| 24 | + <nav-page title="'Bears'" hide-back-button="true" right-buttons="rightButtons" hide-nav-bar="true"> |
| 25 | + <content has-header="true"> |
| 26 | + <h1>Page 1</h1> |
| 27 | + <span>{{num}}</span> |
| 28 | + <a class="button button-pure" nav-back>Back</a> |
| 29 | + <a class="button button-assertive" href="#/page2">Next</a> |
| 30 | + </content> |
| 31 | + </nav-page> |
| 32 | + </script> |
| 33 | + <script id="page2.html" type="text/ng-template"> |
| 34 | + <nav-page title="'Beets'"> |
| 35 | + <content has-header="true"> |
| 36 | + <h1>Page 2</h1> |
| 37 | + <a class="button button-pure" nav-back>Back</a> |
| 38 | + <a class="button button-assertive" href="#/page3">Next</a> |
| 39 | + </content> |
| 40 | + </nav-page> |
| 41 | + </script> |
| 42 | + <script id="page3.html" type="text/ng-template"> |
| 43 | + <nav-page title="'Battlestar Galactica'"> |
| 44 | + <content has-header="true"> |
| 45 | + <h1>Page 3</h1> |
| 46 | + <a class="button button-pure" nav-back>Back</a> |
| 47 | + </content> |
| 48 | + </nav-page> |
| 49 | + </script> |
| 50 | + <script> |
| 51 | + angular.module('navTest', ['ionic']) |
| 52 | + |
| 53 | + |
| 54 | + .config(function($routeProvider, $locationProvider) { |
| 55 | + $routeProvider.when('/cats', { |
| 56 | + templateUrl: 'page1.html', |
| 57 | + controller: 'Page1Ctrl' |
| 58 | + }); |
| 59 | + |
| 60 | + $routeProvider.when('/page2', { |
| 61 | + templateUrl: 'page2.html', |
| 62 | + }); |
| 63 | + |
| 64 | + $routeProvider.when('/page3', { |
| 65 | + templateUrl: 'page3.html', |
| 66 | + }); |
| 67 | + |
| 68 | + $routeProvider.otherwise({ |
| 69 | + redirectTo: '/cats' |
| 70 | + }); |
| 71 | + |
| 72 | + // configure html5 to get links working on jsfiddle |
| 73 | + //$locationProvider.html5Mode(true); |
| 74 | + |
| 75 | + }) |
| 76 | + |
| 77 | + .controller('Page1Ctrl', function($scope) { |
| 78 | + $scope.num = Math.floor(Math.random() * 100); |
| 79 | + |
| 80 | + $scope.rightButtons = [ |
| 81 | + { |
| 82 | + content: 'Hello', |
| 83 | + tap: function(e) { |
| 84 | + console.log('Click button'); |
| 85 | + } |
| 86 | + } |
| 87 | + ] |
| 88 | + }); |
| 89 | + |
| 90 | + |
| 91 | + </script> |
| 92 | + </body> |
| 93 | +</html> |
0 commit comments