angularJS中使用“$window.location.href ”页面跳转,控制台跳出“TypeError: Cannot set property 'href' of undefined”错误,怎么解决?
使用$location服务
1,在控制器里面注入此服务
2,使用$location.url( .....),里面填写地址
window.location.href不需要加$
把$window模块注入进来。
angularJS中使用“$window.location.href ”页面跳转,控制台跳出“TypeError: Cannot set property 'href' of undefined”错误,怎么解决?
使用$location服务
1,在控制器里面注入此服务
2,使用$location.url( .....),里面填写地址
window.location.href不需要加$
把$window模块注入进来。