I am moving my project from angularjs 1.3 beta to 1.4, "$ http get" works fine, but the '$ http post' creates a problem. The following is a user authentication code that works fine in version 1.3 but does not work in version 1.4
factory.authenticate = function (email, password) { var payload = { email: email, password: password }; var rid = Security.reqKey(); payload['rid'] = rid; return $http({ method: 'POST', url: Base_url +'service/auth', param: { rid: rid }, data: $.param(payload), headers: {'Content-Type': 'application/x-www-form-urlencoded'} }); };
After switching to 1.4, it causes an error:
POST http: // localhost / 405 (not allowed) XHR could not load: POST
(which worked great before)
There is a case when this code gives the desired result. If I put the debugger in the Chrome browser and run all the code by pressing f10.
source share