Angular SDK - getting HTTP Response, but deferred not resolving

Hello,

New user here. I’m trying to implement an angular app. Cool stuff so are but I’m having an issue: I have the SDK installed and I copied the code from here: https://github.com/dreamfactorysoftware/angular-dreamfactory into my app.

I have successfully set it up to make calls to the RESTful endpoint that I’ve got set up coming from a remote mySQL db… I get a 200 response and I get data like this in my HTTP response. (I’ve shortened it for brevity)

{“record”:[{“firstName”:“Thelma”,“lastName”:“Brooks”},{“firstName”: “Randy” : “lastName” : “Marsh”]}

However, the success response in my angular service promise never gets fired and subsequent result does not get sent back to my controller.

In fact it looks like the promise gets skipped entirely. I put alerts in both success and failure handlers in my service and they never get hit.

Also did you guys test your code in examples at https://github.com/dreamfactorysoftware/angular-dreamfactory … there are multiple syntactical errors in each of the examples you posted . Very frustrating to work with as a new user coming into it

For example you’re missing a closing ‘)’ at the end of this snippet:

    .controller('MyCtrl', ['DreamFactory', function(DreamFactory) {


  // model for login credentials
  $scope.creds = {
    email: '',
    password: ''
  }

  // Login function
  $scope.loginFunc = function() {

    // Call to the DreamFactory user service using provided login method
    DreamFactory.api.user.login($scope.creds,

      // Success function
      function(data) {

        // Handle login success
      },

      // Error function
      function(error) {

        // Handle Login failure
      }
  }
}];

And you misplaced the final return statement of the deferred promise in the last example on that page.

I just want an example of a controller, service and associated html snippet that will successfully get me a response in the simplest manner possible. Is there a jsfiddle that you guys have that can do this?

Thanks for catching those issues. Michael wrote that module and will respond (we’re about to release 1.8.0, so Michael might take awhile to post).

Sorry for the delay. Michael is cleaning up the syntax errors, sorry about that. We had some bugs with CORS that are fixed in version 1.8 coming out later this week. Once that’s live the SDK should work again…these are backend issues that will be addressed in 1.8.

1 Like

Ben, Thank you for the responses. I’m looking forward to checking out the new version!

DSP Version 1.8 is live on GitHub Dreamfactory Service Platform Version 1.8 and will be deployed to the free hosted system tomorrow. Bitnami installers for 1.8 will be a couple more days.

The Angular SDK at https://github.com/dreamfactorysoftware/angular-dreamfactory has also been updated. Give it a shot now and let us know if you run into any problems. You need to wait for DSP 1.8 to use any tunneled methods in the SDK like getRecordsByPost, but non-tunneled methods should work fine now without DSP 1.8 on the backend.