I am seeing angularJS files where in some places reviewer has commented these 3 lines:
var deferred = $q.defer();
deferred.resolve(BrandList);
return deferred.promise;
and replaced with this one:
return $q.when(BrandList);
I would like to understand the difference between two. Do both serve same purpose? Which should be used when?