I'm not sure if I got a question, but it looks like you built the promise with an interseper, but from your question, it looks like you just want a regular promise. So I will try this.
I'm not an angular expert, but I often use $ http promises, and here's how I do it.
I am registering a $ http call as a service, for example:
app.service('ajax',function(host,$http){ this.post = function(api,data,cb){ $http.post(host + api,data).success(cb) }; this.get = function(api,cb){ $http.get(host + api).success(cb) } });
host is a predefined module.value . I inject this service into every controller that needs to call http requests and manage them like this:
ajax.post('users', UserToken, function(data){ console.log('Users points: ' + data.points) })
As I understand it, $ http has built-in promises, so there is no need for q and defere, all this is done in the background. ajax.post calls a service that sends data to host + 'users' , the server side searches for the user with its token and returns some data with a single key named points with the value of user points. Client side: upon a successful response from the server, it proceeds to the cb function, which then completes the logging of user points.
Therefore, I can perform any modification I need to execute this cb function, since it is not called before the server responds successfully.
There are several additional options in the success and error methods, check them out here .