Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. var createProfile = function (profile) {
  2. var deferred = $q.defer();
  3.  
  4.  
  5. $http.post("localhost/profile", profile)
  6. .success(function(data, status){
  7. deferred.resolve(data);
  8. })
  9. .error(function(error, status){
  10. $rootScope.error = sitesettings.parseErrors(error);
  11.  
  12. })
  13. .finally(function(){
  14. console.log('hello'); // **this message logs**
  15. });
  16.  
  17. return deferred.promise;
  18. };
  19.  
  20. profileFactory.createProfile (profile)
  21. .then(function (data) {
  22. // **works if successful**
  23.  
  24. })
  25. .finally(function () {
  26. console.log('fin'); // **this never fires, successfully or on an error**
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement