'use strict';

/**
 * @ngdoc service
 * @name wavesApp.InflectionsAPIService
 * @description
 * # InflectionsAPIService
 * Service in the wavesApp.
 */
angular.module('wavesApp')
  .service('InflectionsAPIService', ['$http', function ($http) {
      return {
        fetchStartupData: function(key, limit){
          return $http({
            method: 'POST',
            url: '/', 
            data: {key: key, limit: limit}
          });
        },
        
        sendRecognition: function(words){
          return $http({
            method: 'POST',
            url: '/inflect', 
            data: "words[]="+JSON.stringify(words)
          });
        }
      };
    }]);

@@ -594,46 +594,403 @@
     
-data: %22words%5B%5D=%22+JSON.stringify(words)
+transformRequest: function(obj) %7B%0A              var str = %5B%5D;%0A              for(var p in obj)%0A              str.push(encodeURIComponent(p) + %22=%22 + encodeURIComponent(obj%5Bp%5D));%0A              return str.join(%22&%22);%0A            %7D,%0A            headers:%7B%0A              %22Content-Type%22: %22application/x-www-form-urlencoded%22,%0A            %7D,%0A            data: %7B%0A              %22words%5B%5D%22: words%0A            %7D
 %0A   

FIX on post words to InflectAPI.