How can I efficiently open a URL in a new tab after making an API call with the click of a button? Currently, the button triggers the API call and generates the URL.
<button (click)="getUrl()">Connect</button>
In TypeScript:
getUrl() {
setTimeout(() => {
this.url = 'www.google.com';
console.log(this.url);
}, 1000);
}
I need a better method to retrieve the URL from the API and open it in a new tab. The API response time is longer than 50 seconds.