var _createAddress  = function (address) {

        var deferred = $q.defer();
        $http.post(serviceBase + 'api/Addresses/Address',address)
            .success(function (response){
                deferred.resolve(response);
            }).error(function (err) {
                deferred.reject(err);
            });

        return deferred.promise;

    };

i am calling a local api and passing in an address object. The call happens 
and the api is hit at which point i hit a breakpoint... however even though 
i'm stepping through my api and am nowhere near returning a response the 
service still errors with "err : null" .  If i use exactly the same code 
with http.get to another endpoint everything works as expected.. Im 
absolutely bamboozled as to why the error section is firing immediately...  

The c# web api that i am using has the following code that gets hit within 
the controller. 

  [HttpPost]
        public  HttpResponseMessage Address(Address address)
        {
            if (!ModelState.IsValid)
            {
                return 
this.Request.CreateResponse(HttpStatusCode.BadRequest, ModelState); 
            }

            db.Addresses.Add(address);
            db.SaveChanges();

            return this.Request.CreateResponse(HttpStatusCode.OK, address);
        }

I have tried pretty much everything and been trawling code for 2 days 
trying to find an alternative.. It just doesn't make sense. 

TIA if anyone can assist.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to