0

I have the following angular service:

angular.module('app.services.api_login', []) .factory('loginApi', function($http, $q, CONFIG) { return function(email, password) { var promise = $http({ method: 'POST', url: CONFIG.login_url, data: { username: email, password: password }, headers: {'Content-Type': 'application/json'} }). then(function(response){ if (typeof response.data === 'object') { return response; } else { return $q.reject(response); } }, function(error){ return $q.reject(error); }); return promise; } }); 

In the controller, I am able to invoke the service. However, inspecting the Network requests made by the browser, it does an HTTP GET.

Any possible ideas why?

1
  • 1
    There could be an interceptor setup in your project that causes this. Commented Mar 30, 2015 at 14:18

2 Answers 2

1

Remove the '/' at the end of your CONFIG.login_url

Sign up to request clarification or add additional context in comments.

Comments

0

I am using this post method in angularjs.

$http.post('url', data). success(function(data, status, headers, config) { console.log(data); }). error(function(data, status, headers, config) { alert("error"); }); 

1 Comment

how is this an answer to the question?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.