Advertisement
Guest User

conreoller.js

a guest
Dec 15th, 2014
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.78 KB | None | 0 0
  1. angular.module('starter.controllers', ['ngCordova'])
  2.  
  3. .controller('AppCtrl', function($scope, $ionicModal, $timeout, $ionicPlatform,$cordovaDevice) {
  4. // Form data for the login modal
  5. $scope.loginData = {};
  6.  
  7. // Create the login modal that we will use later
  8. $ionicModal.fromTemplateUrl('templates/login.html', {
  9. scope: $scope
  10. }).then(function(modal) {
  11. $scope.modal = modal;
  12. });
  13.  
  14.  
  15. $scope.device = ionic.Platform.device();
  16. $scope.uuid = $scope.device.uuid;
  17. // localStorage.setItem("uuid", uuid);
  18.  
  19.  
  20. console.log($scope.device);
  21. console.log($scope.uuid);
  22.  
  23. // ionic.Platform.ready(function() {
  24. // var device = ionic.Platform.device();
  25. // // alert(device.platform);
  26. // var foo = $cordovaDevice.getUUID();
  27. // alert(foo);
  28. // });
  29.  
  30. if( ionic.Platform.isAndroid() ){
  31. $scope.loginData.uuid=$cordovaDevice.getModel();
  32.  
  33. // alert($cordovaDevice.getModel());
  34. // alert($cordovaDevice.getUUID());
  35.  
  36. }else{
  37. console.log("Is not Android");
  38. // alert("windows");
  39. // alert("testUUID");
  40. }
  41.  
  42.  
  43. $scope.cats={
  44. "MOBILES & TABLETS": [
  45. "Mobiles",
  46. "Tablets",
  47. "Mobile Cases & Covers",
  48. "Earphones",
  49. "Memory Cards",
  50. "Mobile Accessories",
  51. "Value Added Services",
  52. "Power Banks",
  53. "Tablet Accessories",
  54. "Bluetooth Devices",
  55. "Mobile Screen Guards",
  56. "Batteries",
  57. "Cables & Chargers",
  58. "Mobile Spare Parts",
  59. "Digital Goods"
  60. ],
  61. "COMPUTERS & PERIPHERALS": [
  62. "Laptops",
  63. "Desktops",
  64. "Pen Drives",
  65. "External Hard Disks",
  66. "Software",
  67. "Printers & Scanners",
  68. "Routers & Modems",
  69. "Data Cards",
  70. "Mouse",
  71. "Monitors",
  72. "Computer Accessories",
  73. "Computer Components",
  74. "Internal Hard Drives",
  75. "RAM",
  76. "Processor",
  77. "Graphics Card",
  78. "Cooling Pads/Laptop Tables",
  79. "Headphones & Mics",
  80. "Adapters",
  81. "Laptop Batteries",
  82. "Value Added Services",
  83. "Webcams",
  84. "Speakers",
  85. "Keyboard"
  86. ],
  87. "HOME FURNISHING": [
  88. "Bed Linen",
  89. "Bath Linen",
  90. "Curtains & Accessories",
  91. "Mattresses",
  92. "Pillows & Covers",
  93. "Mats & Carpets",
  94. "Cushions & Covers",
  95. "Blankets & Quilts",
  96. "Table & Kitchen Linen",
  97. "Kids Bedding & More",
  98. "Fabrics"
  99. ],
  100. "CLOTHING": [
  101. "Shirts",
  102. "T Shirts",
  103. "Polo T Shirts",
  104. "Sweaters",
  105. "Sweatshirts",
  106. "Jackets",
  107. "Jeans",
  108. "Trousers & Chinos",
  109. "Suitings & Shirtings",
  110. "Kurtas, Pyjamas & Sherwanis",
  111. "Plus Sizes",
  112. "Suits & Blazers",
  113. "Innerwear & Sleepwear",
  114. "Trackpants & Tracksuits",
  115. "Shorts & 3/4ths",
  116. "Nightwear"
  117. ]
  118. };
  119.  
  120.  
  121. $scope.deals=[
  122. {
  123. dealcategory: "Cloth",
  124. dealenddate: "2014-12-10",
  125. dealname: "Buy 1 get 1 Free",
  126. dealstartdate: "2014-12-03",
  127. dealsubcategory: "Men",
  128. description: "Discount Deal",
  129. id: 1
  130. },
  131. {
  132. dealcategory: "Cloth",
  133. dealenddate: "2014-12-14",
  134. dealname: "Buy 1 Get 1",
  135. dealstartdate: "2014-12-13",
  136. dealsubcategory: "Men",
  137. description: "Discount Deal",
  138. id: 2
  139. },
  140. {
  141. dealcategory: "Cloth",
  142. dealenddate: "2014-12-17",
  143. dealname: "Buy Mobile With 20% Offer",
  144. dealstartdate: "2014-12-15",
  145. dealsubcategory: "Men",
  146. description: "Discount Deal",
  147. id: 3
  148. },
  149. {
  150. dealcategory: "Cloth",
  151. dealenddate: "2014-12-17",
  152. dealname: "Buy 1 get 3 free",
  153. dealstartdate: "2014-12-03",
  154. dealsubcategory: "Women",
  155. description: "Discount Deal",
  156. id: 4
  157. },
  158. {
  159. dealcategory: "Electronics",
  160. dealenddate: "2014-12-25",
  161. dealname: "Free ! Free!",
  162. dealstartdate: "2014-12-24",
  163. dealsubcategory: "Mobile",
  164. description: "Discount Deal",
  165. id: 5
  166. }
  167. ];
  168.  
  169.  
  170.  
  171. $scope.login_success=function(){
  172. window.location.href = "#/app/search";
  173. }
  174.  
  175.  
  176. // Triggered in the login modal to close it
  177. $scope.closeLogin = function() {
  178. $scope.modal.hide();
  179. };
  180.  
  181. // Open the login modal
  182. $scope.login = function() {
  183. $scope.modal.show();
  184. };
  185.  
  186. // Perform the login action when the user submits the login form
  187. $scope.doLogin = function() {
  188. console.log('Doing login', $scope.loginData);
  189.  
  190. // Simulate a login delay. Remove this and replace with your login
  191. // code if using a login system
  192. $timeout(function() {
  193. $scope.closeLogin();
  194. }, 1000);
  195. };
  196. })
  197.  
  198. .controller('PlaylistsCtrl', function($scope) {
  199. $scope.playlists = [
  200. { title: 'Reggae', id: 1 },
  201. { title: 'Chill', id: 2 },
  202. { title: 'Dubstep', id: 3 },
  203. { title: 'Indie', id: 4 },
  204. { title: 'Rap', id: 5 },
  205. { title: 'Cowbell', id: 6 }
  206. ];
  207. })
  208.  
  209. .controller('PlaylistCtrl', function($scope, $stateParams) {
  210. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement