Hi,
        We have services that return 'deferred.promise'. But we also have 
'functional constructors' which constitute the domain model. Our 
controllers receive the promise directly. In order to break this dependency 
I want to return a JS functional constructor from the service.

This functional constructor should be created and returned instead of 
'deferred.promise'.

What are the techniques available to do this ?

    return {  

          asynchcall:function() {
                        var deferred = $q.defer();
                        Somecall().then(
                                function(resp) {
                                    deferred.resolve(resp);
                                },
                                function(resp) {
                                    deferred.reject({
                                        status: resp.status
                                    });
                                });
                        return deferred.promise;
                    }
    };


Thanks,
Mohan

-- 
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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to