angularjs - 使用 $location.path 重定向到另一个 url
问题描述
我必须从我的实际网页重定向到新的 url,我从后端的响应中获取 url。
var url = res.response.data.link;
$location.url(url);
但是我的网址附加了我的本地主机网址,如何避免这种情况
http://127.0.0.1:50966/index.html#/https://www.paypal.com
解决方案
使用$window
而不是window
,还要确保你也在$window
注入controller
。
$window.location.href = url;
推荐阅读
- firebase - 快照在 StreamBuilder 颤振中始终返回空数据
- python - 删除以 \ud 开头的部分字符串
- flutter - 我如何在颤动中使用 2 个身体
- javascript - 尝试使用 fetch put 编辑数据但无法引用正确的 id
- c - 将 void 指针(它是结构的一部分)转换为另一种指针数据类型
- plot - 使用动态线宽时无法绘图
- python - Top3 K 标签的精度和召回率
- php - 流明/laravel 采摘不适合关系
- python - Discord.py 公告频道的代码是什么?
- c++ - MSVC Address Sanitizer - 有什么理由在 Release 版本中使用它?