Subversion Repositories SmartDukaan

Rev

Rev 13542 | Rev 13557 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
13542 anikendra 1
// Ionic Starter App
2
 
3
// angular.module is a global place for creating, registering and retrieving Angular modules
4
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
5
// the 2nd parameter is an array of 'requires'
6
// 'starter.services' is found in services.js
7
// 'starter.controllers' is found in controllers.js
8
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'starter.filters', 'LocalStorageModule','ngResource'])
9
 
13551 anikendra 10
.run(function($ionicPlatform,$rootScope) {
11
  $rootScope.likeProduct = function(id){
12
    alert('like '+id);
13
    console.log(id);
14
  },
15
  $rootScope.unlikeProduct = function(id){
16
    alert('unlike '+id);
17
    console.log(id);
18
  }
19
  $rootScope.viewproduct = function(id){
20
    alert('view product '+id);
21
  } 
22
  $rootScope.chunk = function(arr, size) {
23
    var newArr = [];
24
    for (var i=0; i<arr.length; i+=size) {
25
      newArr.push(arr.slice(i, i+size));
26
    }
27
    return newArr;
28
  } 
13542 anikendra 29
  $ionicPlatform.ready(function() {
30
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
31
    // for form inputs)
32
    if (window.cordova && window.cordova.plugins.Keyboard) {
33
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
34
    }
35
    if (window.StatusBar) {
36
      // org.apache.cordova.statusbar required
37
      StatusBar.styleDefault();
38
    }
39
  });
40
})
41
 
42
.config(function($stateProvider, $urlRouterProvider) {
43
 
44
  // Ionic uses AngularUI Router which uses the concept of states
45
  // Learn more here: https://github.com/angular-ui/ui-router
46
  // Set up the various states which the app can be in.
47
  // Each state's controller can be found in controllers.js
48
  $stateProvider
49
 
50
  // setup an abstract state for the tabs directive
51
  .state('tab', {
52
    url: "/tab",
53
    abstract: true,
54
    templateUrl: "templates/tabs.html"
55
  })
56
 
57
  // Each tab has its own nav history stack:
58
 
59
  .state('tab.dash', {
60
    url: '/dash',
61
    views: {
62
      'tab-dash': {
63
        templateUrl: 'templates/tab-dash.html',
64
        controller: 'DashCtrl'
65
      }
66
    }
67
  })
68
 
69
  .state('tab.chats', {
70
      url: '/chats',
71
      views: {
72
        'tab-chats': {
73
          templateUrl: 'templates/tab-chats.html',
74
          controller: 'ChatsCtrl'
75
        }
76
      }
77
    })
78
    .state('tab.chat-detail', {
79
      url: '/chats/:chatId',
80
      views: {
81
        'tab-chats': {
82
          templateUrl: 'templates/chat-detail.html',
83
          controller: 'ChatDetailCtrl'
84
        }
85
      }
86
    })
87
 
88
  .state('tab.friends', {
89
      url: '/friends',
90
      views: {
91
        'tab-friends': {
92
          templateUrl: 'templates/tab-friends.html',
93
          controller: 'FriendsCtrl'
94
        }
95
      }
96
    })
97
    .state('tab.friend-detail', {
98
      url: '/friend/:friendId',
99
      views: {
100
        'tab-friends': {
101
          templateUrl: 'templates/friend-detail.html',
102
          controller: 'FriendDetailCtrl'
103
        }
104
      }
105
    })
106
 
107
  .state('tab.login', {
108
    url: '/login',
109
    views: {
110
      'tab-login': {
111
        templateUrl: 'templates/tab-login.html',
112
        controller: 'LoginCtrl'
113
      }
114
    }
115
  })
116
 
117
  .state('tab.account', {
118
    url: '/account',
119
    views: {
120
      'tab-account': {
121
        templateUrl: 'templates/tab-account.html',
122
        controller: 'AccountCtrl'
123
      }
124
    }
125
  });
126
 
127
  // if none of the above states are matched, use this as the fallback
128
  $urlRouterProvider.otherwise('/tab/dash');
129
 
130
});