在angularjs可实现页面跳转的各种方式


法一、$location.path("/index/clientTakeGoods/clientTakeGoodsResult");(不支持火狐)
法二、$state.go('index.clientTakeGoods.clientTakeGoodsResult');(不支持谷歌)
法三、var url=$state.href('index.clientTakeGoods.clientTakeGoodsResult',{basicType:8});
   window.open(url,'_self');
法四、window.location="/index#/index/clientTakeGoods/clientTakeGoodsResult";

 

 

 

$state.go和$location.href有什么区别

前者不在浏览器中保存跳转前的网址,因此按返回键将无效 后者不存在这个问题  reload方法,强迫浏览器刷新当前页面 
replace方法,通过指定URL替换当前缓存在历史里(客户端)的项目,因此当使用replace方法之后,你不能通过“前进”和“后退”来访问已经被替换的URL。
在实际应用的时候,重新刷新页面的时候,我们通常使用: location.reload() 或者是 history.go(0) 来做。。因为这种做法就像是客户端点F5刷新页面,
所以页面的method="post"的时候,会出现“网页过期”的提示。那是因为Session的安全保护机制。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM