如何使用angular Router导航到外部URL

问题描述

我被困在这里很久了。如何替换window.location.href = url以使用Angular路由?

checkforStoredLocale() {
  if (this.storedlocale && this.storedlocale !== this.localeId) {
    this.consoleService.consoleMessage('redirecting');
    let port = this.location.port.length > 0 ? `:${this.location.port}` : '';
    let url = `${this.location.protocol}//${this.location.hostname}${port}${this.baseHref}${this.storedlocale}${this.location.pathname}`;
    this.consoleService.consoleMessage(url);
    // this.route.navigateByUrl(url);
    window.location.href = url;
  }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)