I have 2 $http calls that return promises but the first one is optional. I believe that I have to first create a promise using $q.defer()
but I am missing something.
Here's my non working attempt:
var p = $q.defer();
if (condition) {
p = p.then(doOptionalFirst());
}
return p.then(doOther());
What is correct syntax to chain these 2 calls with the first being optional?