javascript - Problems when passing parameters of an Angular application for a Rails controller -
i have application made in angularjs, i'm having trouble reading parameters on server side.
as i'm sending data:
api.factory('authprovider', function($resource, env){ var baseurl = env.apiendpoint; return $resource(baseurl, null, { login: { method: 'post', url: baseurl+'sessions' } }); }); angular.module('tuneduc.controllers.admin',[]) .controller('admincontroller', function($scope, $location, authprovider) { var auth; $scope.login = function (credentials) { auth = new authprovider(credentials) auth.$login(function(res) { console.log('success'); }, function(res) { console.log(res.data.errors); }) } });
so parameters coming way on server:
{"{\"email\":\"assdaf@adfasdf.com\",\"password\":\"sadfsdf\"}"=>nil, "controller"=>"sessions", "action"=>"create"}
i've tried using json.stringify () failed.
Comments
Post a Comment