You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
864 B

7 years ago
  1. angular.module('app.main', ['pascalprecht.translate'])
  2. .controller('MainCtrl', function($scope, $stateParams, $translate, $filter,
  3. $ionicLoading, $http) {
  4. if (localStorage.getItem("cim_app_userdata")) {
  5. $scope.storageuser = JSON.parse(localStorage.getItem("cim_app_userdata"));
  6. console.log($scope.storageuser);
  7. }
  8. //get the num of pendent notifications each time
  9. $http.get(urlapi + 'numnotifications')
  10. .then(function(data) {
  11. $scope.storageuser.notifications = data.data;
  12. console.log(data.data);
  13. localStorage.setItem("cim_app_storageuser", JSON.stringify($scope.storageuser));
  14. }, function(data) {
  15. console.log('data error');
  16. $ionicLoading.show({
  17. template: 'Error connecting server',
  18. noBackdrop: true,
  19. duration: 2000
  20. });
  21. });
  22. });