Advertisement
Guest User

bhrun's app

a guest
Aug 28th, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. // APP.JS
  2. angular.module('starter', ['angularytics', 'ionic', 'starter.controllers', 'starter.services'])
  3.  
  4. .config(function(AngularyticsProvider) {
  5. AngularyticsProvider.setEventHandlers(['Console', 'GoogleUniversal']);
  6. })
  7. .run(function(Angularytics) {
  8. Angularytics.init();
  9. })
  10. .run(function($ionicPlatform) {
  11. $ionicPlatform.ready(function() {
  12. // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
  13. // for form inputs)
  14. if(window.cordova && window.cordova.plugins.Keyboard) {
  15. cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
  16. }
  17. if(window.StatusBar) {
  18. // org.apache.cordova.statusbar required
  19. StatusBar.styleDefault();
  20. }
  21. });
  22. })
  23. .config(function($stateProvider, $urlRouterProvider) {
  24. $stateProvider
  25.  
  26. // setup an abstract state for the tabs directive
  27. .state('tab', {
  28. url: "/tab",
  29. abstract: true,
  30. templateUrl: "templates/tabs.html"
  31. })
  32. .state('tab.dash', {
  33. url: '/dash',
  34. views: {
  35. 'tab-dash': {
  36. templateUrl: 'templates/tab-dash.html',
  37. controller: 'DashCtrl'
  38. }
  39. }
  40. })
  41. .state('tab.friends', {
  42. url: '/friends',
  43. views: {
  44. 'tab-friends': {
  45. templateUrl: 'templates/tab-friends.html',
  46. controller: 'FriendsCtrl'
  47. }
  48. }
  49. })
  50. .state('tab.friend-detail', {
  51. url: '/friend/:friendId',
  52. views: {
  53. 'tab-friends': {
  54. templateUrl: 'templates/friend-detail.html',
  55. controller: 'FriendDetailCtrl'
  56. }
  57. }
  58. })
  59. .state('tab.account', {
  60. url: '/account',
  61. views: {
  62. 'tab-account': {
  63. templateUrl: 'templates/tab-account.html',
  64. controller: 'AccountCtrl'
  65. }
  66. }
  67. })
  68. $urlRouterProvider.otherwise('/tab/dash');
  69. });
  70.  
  71. // SERVICES.JS
  72. angular.module('starter.services', [])
  73. .factory('Friends', function() {
  74. var friends = [
  75. { id: 0, name: 'Scruff McGruff' },
  76. { id: 1, name: 'G.I. Joe' },
  77. { id: 2, name: 'Miss Frizzle' },
  78. { id: 3, name: 'Ash Ketchum' }
  79. ];
  80. return {
  81. all: function() {
  82. return friends;
  83. },
  84. get: function(friendId) {
  85. return friends[friendId];
  86. }
  87. }
  88. });
  89.  
  90. // CONTROLLERS.JS
  91. angular.module('starter.controllers', [])
  92. .controller('DashCtrl', function($scope) {
  93. })
  94. .controller('FriendsCtrl', function($scope, Friends) {
  95. $scope.friends = Friends.all();
  96. })
  97. .controller('FriendDetailCtrl', function($scope, $stateParams, Friends) {
  98. $scope.friend = Friends.get($stateParams.friendId);
  99. })
  100. .controller('AccountCtrl', function($scope) {
  101. });
  102.  
  103. // INDEX.HTML
  104. <!DOCTYPE html>
  105. <html>
  106. <head>
  107. <meta charset="utf-8">
  108. <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
  109. <title></title>
  110. <link href="lib/ionic/css/ionic.css" rel="stylesheet">
  111. <link href="css/style.css" rel="stylesheet">
  112.  
  113. <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
  114. <link href="css/ionic.app.css" rel="stylesheet">
  115. -->
  116.  
  117. <script src="lib/ionic/js/ionic.bundle.js"></script>
  118. <script src="cordova.js"></script>
  119.  
  120. <script src="js/app.js"></script>
  121. <script src="js/controllers.js"></script>
  122. <script src="js/services.js"></script>
  123. <script src="js/angularytics.min.js"></script>
  124. <script>
  125. (function (i, s, o, g, r, a, m) {
  126. i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
  127. (i[r].q = i[r].q || []).push(arguments)
  128. }, i[r].l = 1 * new Date(); a = s.createElement(o),
  129. m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
  130. })(window, document, 'script', 'http://www.google-analytics.com/analytics.js', 'ga');
  131.  
  132. ga('create', 'UA-48718316-3', 'auto');
  133. ga('set', 'checkProtocolTask', null);
  134. </script>
  135. </head>
  136. <body ng-app="starter" animation="slide-left-right-ios7">
  137. <ion-nav-bar class="bar-stable nav-title-slide-ios7">
  138. <ion-nav-back-button class="button-icon icon ion-ios7-arrow-back">
  139. Back
  140. </ion-nav-back-button>
  141. </ion-nav-bar>
  142. <ion-nav-view></ion-nav-view>
  143. </body>
  144. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement