How to open a new browser Tab , if using router.navigate .
this.router.navigate([]).then(result => { window.location.href = link; });
How to open a new browser Tab , if using router.navigate .
this.router.navigate([]).then(result => { window.location.href = link; });
Try this one.
this.router.navigate([]).then(result => { window.open(link, '_blank'); });
currently i believe angular doesn't offer any method or service to do that so i've to use window
object to open links in a new tab
window.open(link, '_blank')
this will open in new tab :
this._router.navigate([]).then(result => { window.open( `/customer/edit/${customer_id_param}`, '_blank'); });
To navigate to a new tab, instead of calling navigate directly:
this.router.navigate(routerCommands, { queryParams });
Use createUrlTree and serializeUrl, so you can build your URL with the same parameters used in navigate() but without navigating the current tab (only the new one):
const link = this.router.serializeUrl(this.router.createUrlTree(routerCommands, { queryParams }));
window.open(link, '_blank');
const reportUrl = this._router.createUrlTree(['/your-url/endpoint',
{data:"Data to pass"}]).toString();
window.open(reportUrl, '_blank');
Try this
Esto deberia funcionar tambien en angular:
abrirVentana() {
var URL = 'https://stackoverflow.com/';
window.open(URL, '_blank');
}