Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 10th, 2012  |  syntax: None  |  size: 0.65 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. AngularJS Failed Resource GET
  2. //this is valid syntax
  3. $scope.word = Word.get({ id : $routeParams.id },function() {
  4.     //this is valid, but won't be fired if the HTTP response is 404 or any other http-error code
  5. });
  6.  
  7. //this is something along the lines of what I what I want to have (NOT THIS IS INVALID AND DOESN'T EXIST)
  8. $scope.word = Word.get({ id : $routeParams.id },{
  9.     success : function() {
  10.       //good
  11.     },
  12.     failure : function() {
  13.       //404 or bad
  14.     }
  15. });
  16.        
  17. $scope.word = Word.get({ id : $routeParams.id },function() {
  18.     //good code
  19. }, function(response, getResponseHeaders) {
  20.     //404 or bad
  21.     if(response.status === 404){
  22.     }
  23. });