[英]angularjs ng-include does not reload when history back button is clicked
I have written a script which dynamically changes the ng-include
source and loads a different template based on URL's with a hash (#). 我编写了一个脚本,该脚本可动态更改
ng-include
源,并基于带有散列(#)的URL加载不同的模板。
Example links are: 示例链接是:
example.com/test#template-1.html
example.com/test#template-2.html
Is there a way for ng-include
to reload the template when the history back button is clicked. 单击历史记录后退按钮时,
ng-include
可以重新加载模板。 I do not wish to make use of ng-route
at this point. 我现在不希望使用
ng-route
。 I just need to know if there is a way to do this with ng-include
. 我只需要知道是否可以使用
ng-include
做到这一点。
您可以在JavaScript中使用“ onbeforeunload ”事件,并为ng-include变量设置值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.