Display the loading spinner gif for all angular ajax requests

Remove the ajax-loader.gif which appeared only in unused styles.
This commit is contained in:
Hyzual 2015-05-28 22:07:17 +02:00
parent 8a81d7b9eb
commit 96aa1be2cf
6 changed files with 78 additions and 60 deletions

View file

@ -1,6 +1,6 @@
angular.module('JamStash')
.controller('AppController', ['$scope', '$rootScope', '$document', '$window', '$location', '$cookieStore', '$http', 'utils', 'globals', 'model', 'notifications', 'player', 'persistence', 'Page', 'subsonic',
function ($scope, $rootScope, $document, $window, $location, $cookieStore, $http, utils, globals, model, notifications, player, persistence, Page, subsonic) {
.controller('AppController', ['$scope', '$rootScope', '$document', '$window', '$location', '$cookieStore', '$http', 'utils', 'globals', 'model', 'notifications', 'player', 'persistence', 'Page', 'subsonic', 'Loading',
function ($scope, $rootScope, $document, $window, $location, $cookieStore, $http, utils, globals, model, notifications, player, persistence, Page, subsonic, Loading) {
'use strict';
$rootScope.settings = globals.settings;
@ -27,6 +27,17 @@ angular.module('JamStash')
$location.path(path);
};
$scope.loading = Loading;
// TODO: Hyz: remove when there are no longer jQuery ajax calls
$.ajaxSetup({
'beforeSend': function () {
$("#loading").removeClass('ng-hide');
},
'complete': function () {
$("#loading").addClass('ng-hide');
}
});
// Reads cookies and sets globals.settings values
$scope.loadSettings = function () {
// Temporary Code to Convert Cookies added 2/2/2014
@ -58,15 +69,6 @@ angular.module('JamStash')
notifications.updateMessage(setting + ' : ' + globals.settings[id], true);
};
$.ajaxSetup({
'beforeSend': function () {
$("#loading").show();
},
'complete': function () {
$("#loading").hide();
}
});
var submenu_active = false;
$('div.submenu').mouseenter(function () {
submenu_active = true;