扫码关注官方订阅号
angularJS中使用“$window.location.href ”页面跳转,控制台跳出“TypeError: Cannot set property 'href' of undefined”错误,怎么解决?
ringa_lee
window.location.href不需要加$
把$window模块注入进来。
使用$location服务1,在控制器里面注入此服务2,使用$location.url( .....),里面填写地址
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
window.location.href不需要加$
把$window模块注入进来。
使用$location服务
1,在控制器里面注入此服务
2,使用$location.url( .....),里面填写地址