【问题标题】:angularjs: how to redirect to a different url?angularjs:如何重定向到不同的网址?
【发布时间】:2018-02-13 00:10:46
【问题描述】:

在我的 angularjs 应用程序中,我想重定向到不同的站点/域。我正在使用:

$location.url(someOtherDomain);

如何从我的 angularjs 应用重定向到这个 url?

【问题讨论】:

标签: javascript angularjs


【解决方案1】:

可以使用$window可以注入的对象:

return $window.location = 'https://someurl.com'

【讨论】:

    【解决方案2】:

    您可以使用以下方法:

    $window.open('https://someurl.com','_blank');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-09
      • 1970-01-01
      • 2018-05-09
      相关资源
      最近更新 更多