
How to use javaScript Promises in lightning components:- In salesforce lightning component if you want to set attribute values immediately after a apex server call you can use the javascript promise.
Promises can simplify code that handles the success or failure of asynchronous calls, or code that chains together multiple asynchronous calls.
In this following example, i am making a server call using promise to get dropdown values once call is success then i chained a one more promise to set default value for the dropdown from backend.
For a great introduction to promises, see https://developers.google.com/web/fundamentals/getting-started/primers/promises.
Leave a Reply