I have the following controller:
function RegisterFormCtrl($scope, $http) {
$scope.master = {};
$scope.response = {};
$scope.update = function(reguser) {
reguser.contactInfo.name = "MAIN";
reguser.contactInfo.phone = "333-333-3333";
reguser.contactInfo.address = "333 Elm St Indiana PA 15701";
reguser.contactInfo.email = "someemail@johnson.com";
reguser.name = "Joe Johnson";
reguser.username = "joe.johnson";
reguser.password1 = "abcDEF123-";
reguser.password2 = "abcDEF123-";
$scope.master = angular.copy(reguser);
$http.post('http://imac.local:8080/api/register', reguser)
.then(
function(response) {
console.log("SUCCESS");
console.log(response);
},
function(response) {
console.log("FAIL");
console.log(response);
});
};
When I trigger the update method, the $http.post kicks off and works technically. Meaning it fires sends the right data to my server, the server (restify) returns a 201 and Angular registers it.
REQUEST HEADERS:
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:28.0) Gecko/20100101 Firefox/28.0
Referer: http://imac.local:8000/app/?
Pragma: no-cache
Origin: http://imac.local:8000
Host: imac.local:8080
Content-Type: application/json;charset=utf-8
Content-Length: 222
Connection: keep-alive
Cache-Control: no-cache
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Accept: application/json, text/plain, */*
RESPONSE HEADERS:
Date: Sun, 06 Apr 2014 19:21:16 GMT
Content-Type: application/json
Content-Length: 333
Connection: keep-alive
RESULT:
Request URL: http://imac.local:8080/api/register
Request Method: POST
Status Code: HTTP/1.1 201 Created
However, the failure method gets called, "FAIL" gets printed, and the response object is empty.
One thing to note, the server is running on a different port on the same machine:
client: http://imac.local:8000
server: http://imac.local:8080
I bring it up, because chrome wouldn't even fire post I have to run it in firefox because of non origin failure despite the same domain locally.
I'm about 3 days old as far as Angular/Node/JS goes so any help would be appreciated.
Thanks in advance.