Skip to content
Advertisement

Tag: asynchronous

is there any workaround for returning the value of res from readCsv() method instead of undefined?

the scenario is i am having the file uploader, which accept .json,.csv file after having file, If i clicked on upload button ,then homeComponent call the service dataparser , which is having two function readJson readCsv, and readcsv function returning the observable other one returns array ,this is simple i have to call the both function on if else and

Why then doesn’t keep the order of the callbacks?

I have the following code: I thought that the output should be first ‘123’ and then ‘should wait’. From unclear reason the ‘should wait’ is printed first. I thought that the second then won’t start until the asynchrony function (setTimeout) won’t finished. I read that this is all the “magic” of using Promise and then. Now i’m very confused. Why

Advertisement