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);
    });
}

 


Revision #1
Created 16 March 2025 02:01:07 by glwhite
Updated 16 March 2025 02:01:26 by glwhite