I have a promise that returns a function, the function does have its own error handling but sometimes for some reason this gets missed (need to explore this later).
I want to add a fallback that if the promise fails/null then return another function.
if (completedForm.isValid()) {
return formDataQueue.push(formJson, this.company).then(function () {
return self.trySync();
});
}
Return self.trySync():
needs a error handler to assume it's not there as if it was commented out. My attempt does not seem to work.
if (completedForm.isValid()) {
return formDataQueue.push(formJson, this.company).then(function () {
//return self.trySync();
}, function(error) {
router.navigate('home');
});
}