I am not sure what i am doing wrong here -
function clearBefore(val) {
if (val.isEnrolled && val.name === 'XYZ') {
vm.clear(val, 'Hello').then(function(value){
return value;
});
return true;
}
}
then calling it -
clearBefore(val).then(function (returnVal) {});
I am new to promises, please let me know how the function should be updated to return a promise.
vm.clear(val, 'Hello').then(function(value)What isvm?vm.clearreturn a promise?vm.clear(...).then(...)and/or directlyreturn vm.clear(...). I'll update my answer.