Angular 2 Routing navigate run in new tab(Use Angular Router naviagte )

后端 未结 5 1372
我在风中等你
我在风中等你 2021-01-01 17:51

How to open a new browser Tab , if using router.navigate .

this.router.navigate([]).then(result => { window.location.href = link; });
相关标签:
5条回答
  • 2021-01-01 17:59

    Try this one.

    this.router.navigate([]).then(result => {  window.open(link, '_blank'); });
    
    0 讨论(0)
  • 2021-01-01 17:59

    this will open in new tab :

     this._router.navigate([]).then(result => {  window.open( `/customer/edit/${customer_id_param}`, '_blank'); });
    
    0 讨论(0)
  • 2021-01-01 18:07

    Esto deberia funcionar tambien en angular:

      abrirVentana() {
    var URL = 'https://stackoverflow.com/';
    window.open(URL, '_blank');
    

    }

    0 讨论(0)
  • 2021-01-01 18:13
    window.open(window.location.href+"/yourRoute", '_blank');
    
    0 讨论(0)
  • 2021-01-01 18:22

    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')

    0 讨论(0)
提交回复
热议问题