I found this codesnippet. Can somebody explain the purpose of the .bind(this) in this context? Where would we be able to access this now? In the resolved promise?
get: function(endpoint, params, callback) {
var cb = callback || angular.noop;
var deferred = $q.defer();
$http.get(
endpoint,
params
).
success(function(data) {
deferred.resolve(data);
return cb();
}).
error(function(err) {
deferred.reject(err);
return cb(err);
}.bind(this));
return deferred.promise;
}