Monday 30 December 2019

angular - How to use chain calls Promise?



Now in .then section I all another promise http request:



.then(result => { this.service().then(data => {}); });


Is it a correct way to use chained promises?


Answer



Almost! You need to return the promise in the function, either like this:



.then(result => { return this.service().then(data => {}); });


or like this:



.then(result => this.service().then(data => {}));

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...