Skip to main content

Angular: How to Return a Promise

You will come across the need to return a promise from a function.

Here’s an example of a promise that resolves itself immediately:

private getStudyPeriods(): Promise<CurrentPeriod> {
    let data = [];

    return new Promise(resolve => {
        resolve(data);
    });
}