-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
48 lines (41 loc) · 1.48 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* Created by championswimmer on 26/7/15.
*/
'use strict';
var bytesApp = angular.module('bytes', [
'ui.router',
'ngMaterial',
'ngStorage',
'bytes.sidebar',
'bytes.orderinfo'
]);
bytesApp.config(['$urlRouterProvider', '$httpProvider', function($urlRouterProvider, $httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
//$urlRouterProvider.otherwise('/1');
}]);
bytesApp.controller('AppController',
['$mdSidenav', '$mdMedia', '$sessionStorage', '$state', 'ApiJsonFactory',
function($mdSidenav, $mdMedia, $sessionStorage, $state, ApiJsonFactory) {
var app = this;
app.toggleSidenav = function(menuId) {
$mdSidenav(menuId).toggle();
};
app.$storage = $sessionStorage;
app.$storage.$reset();
if ( app.$storage.orders === null ||
typeof(app.$storage.orders) == 'undefined')
{
app.$storage.orders = [];
}
app.Orders = app.$storage.orders;
if (app.Orders.length === 0) {
ApiJsonFactory.getJson('outlets/orders/2')
.then(function (response) {
app.Orders = response.data;
app.$storage.orders = app.Orders;
}, function (error) {
console.error(error);
});
}
}]);