Skip to content

Instantly share code, notes, and snippets.

'use strict';
/**
* @ngdoc overview
* @name ngResource
* @description
*/
/**
* @ngdoc object
KK.factory('TokenHandler', ['$cookieStore', function ($cookieStore) {
var tokenHandler = {};
tokenHandler.setToken = function (newToken) {
$cookieStore.put("X-Authorization-Token", newToken);
console.log('set token ' + newToken);
};
tokenHandler.getToken = function () {
console.log('get cookie ' + $cookieStore.get("X-Authorization-Token"));
KK.factory('httploadingInterceptor',['$q','$rootScope', function ($q, $rootScope) {
return function (promise) {
$rootScope.loading = true;
return promise.then(function (response) {
// hide the spinner
$rootScope.loading = false;
return response;