foo: function() {
let documentsAttachedToProcess = DocumentService.getAttachedDocuments('id_procesu')
.then(result => successFn(result))
.catch(error => failureFn(error));
console.log('bar'); // code will trigger without waiting for the result from the called service method to be served
} |