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.

25 lines
1.0 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. angular.module('app.notifications', ['pascalprecht.translate'])
  2. .controller('NotificationsCtrl', function($scope, $http, $ionicLoading,
  3. $stateParams, $translate, $filter) {
  4. $scope.notifications=[];
  5. $scope.doRefresh = function(){
  6. $http.get(urlapi + 'notifications')
  7. .then(function(data){
  8. console.log(data); // for browser console
  9. $scope.storageuser = JSON.parse(localStorage.getItem("cim_app_userdata"));
  10. $scope.storageuser.notifications = data.data;
  11. localStorage.setItem("cim_app_userdata", JSON.stringify($scope.storageuser));
  12. $scope.notifications = data.data; // for UI
  13. $scope.$broadcast('scroll.refreshComplete');//refresher stop
  14. }, function(data){
  15. console.log('data error');
  16. $scope.$broadcast('scroll.refreshComplete');//refresher stop
  17. $ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 });
  18. });
  19. };
  20. $scope.doRefresh();
  21. });