var PicsService = function($http, $q, $cacheFactory) {
  this.http_ = $http;
  this.q_ = $q;
  
  this.indexCache = $cacheFactory.get("PicsService");
  if (!this.indexCache) {
   this.indexCache = $cacheFactory("PicsService", {
    capacity: 20
   });
   
   this.picCache = $cacheFactory.get("PicsService-pics");
   if (!this.picCache) {
     this.picCache = $cacheFactory("PicsService-pics", {
      capacity: 241 // 4 pages worth, two in each direction, plus 1.
     });
   }
  }
};

PicsService.prototype.getSingle = function(picId) {
  var deferred = this.q_.defer();
  var httpConfig = {
    params: {
      pic_id: picId
    }
  };
  this.http_.get("/api/lookupPicDetails", httpConfig).then(
    function(res) {
      deferred.resolve(res.data);
    },
    function(error) {
      deferred.reject(error);
    }
  );
  
  return deferred.promise;
}

PicsService.prototype.incrementViewCount = function(picId) {
  var deferred = this.q_.defer();
  var httpConfig = {
    params: {
      pic_id: picId
    }
  };
  this.http_.get("/api/incrementPicViewCount", httpConfig).then(
    function(res) {
      deferred.resolve(res.data);
    },
    function(error) {
      deferred.reject(error);
    }
  );

  return deferred.promise;
}

PicsService.prototype.deletePic = function(picId, details) {
  var deferred = this.q_.defer();
  var httpConfig = {
    params: {
      pic_id: picId,
      details: details
      // TODO: add pending deletion time
    }
  };
  this.http_.get("/api/softDeletePic", httpConfig).then(
    function(res) {
      this.indexCache.removeAll();
      this.picCache.removeAll();
      deferred.resolve(res.data);
    }.bind(this),
    function(error) {
      deferred.reject(error);
    }
  );
  return deferred.promise;
}

PicsService.prototype.getNextIndexPics = function(startId) {
  var deferred = this.q_.defer();
  var picCache = this.picCache;
  var httpConfig = {};
  if (startId) {
      httpConfig["params"] = {
        "start_pic_id": startId
      };
      httpConfig["cache"] = this.indexCache;
  }
  this.http_.get("/api/findNextIndexPics", httpConfig).then(
    function(res, status, headers, config) {
      res.data.forEach(function(pic){
        picCache.put(pic.id, pic);
      });
      deferred.resolve(res.data);
    },
    function(error) {
      deferred.reject(error);
    }
  );
  return deferred.promise;
}

PicsService.prototype.getPreviousIndexPics = function(startId) {
  var deferred = this.q_.defer();
  var httpConfig = {};
  var picCache = this.picCache;
  if (startId) {
      httpConfig["params"] = {
        "start_pic_id": startId
      };
      httpConfig["cache"] = this.indexCache;
  }
  this.http_.get("/api/findPreviousIndexPics", httpConfig).then(
    function(res, status, headers, config) {
      res.data.forEach(function(pic){
        picCache.put(pic.id, pic);
      });
      deferred.resolve(res.data);
    },
    function(error) {
      deferred.reject(error);
    }
  );
  return deferred.promise;
}

PicsService.prototype.create = function(file, url) {
  var deferred = this.q_.defer();

  var data = new FormData();
  data.append("url", url);
  if (file != null) {
    data.append("file", file);
  }
  var postConfig = {
    transformRequest: angular.identity,
    headers: {'Content-Type': undefined},
  };
  this.http_.post("/api/createPic", data, postConfig).then(
    function(data, status, headers, config) {
      deferred.resolve(data);
    },
    function(data, status, headers, config) {
      console.log(data);
      console.log(status);
    }
  );
  return deferred.promise;
};


@@ -954,56 +954,330 @@
 var 
-httpConfig = %7B%0A    params: %7B%0A      pic_id: picId
+params = %7B%0A      %22pic_id%22: picId%0A    %7D%0A  var httpConfig = %7B%0A    %22headers%22:  %7B%0A      %22Content-Type%22: %22application/x-www-form-urlencoded%22%0A    %7D,%0A    %22transformRequest%22: function(o) %7B%0A      var str = %5B%5D;%0A      for(var p in o)%0A      str.push(encodeURIComponent(p) + %22=%22 + encodeURIComponent(o%5Bp%5D));%0A      return str.join(%22&%22);
 %0A   
@@ -1276,32 +1276,37 @@
 &%22);%0A    %7D%0A  %7D;%0A
+    %0A
   this.http_.get
@@ -1294,34 +1294,35 @@
   %0A  this.http_.
-ge
+pos
 t(%22/api/incremen
@@ -1336,16 +1336,24 @@
 wCount%22,
+ params,
  httpCon

Make view count increment calls POST