Created
June 9, 2015 19:50
-
-
Save zacharyblank/90af2ebfb32ca26bd6bd to your computer and use it in GitHub Desktop.
$q explained
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.get = function(data) { | |
var deferred = $q.defer(); | |
resource.get(data, function(response) { | |
if (typeof response.data == 'object') { | |
deferred.resolve(new Venue(response.data)); | |
} else { | |
deferred.reject(); | |
} | |
}, function() { | |
deferred.reject(); | |
}); | |
return deferred.promise; | |
} |
Author
zacharyblank
commented
Jun 9, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment