结构-行为-样式-跳转并刷新

这几天在做项目需要跳转并刷新,我们项目是用的Angularjs的框架 ,并且是投放在70寸的大电视上,还需要定时跳转。

遇到的问题就是在页面跳转了之后,浏览器占用内存一直在增加,查看了好久,最终下面代码解决问题:

//设置五分钟跳转一次
                var time1 = setInterval(function(){
                    var currentPath = $location.$$path.split("/").join(".").slice(1);
                    switch (currentPath) {
                        case "blue.analysis":
                             window.location.href='#/blue/overview';
                             window.close();
                             window.location.reload(true);
                            break;
                        case "blue.overview":
                             window.location.href='#/blue/store';
                             window.close();
                             window.location.reload(true);
                            break;
                        case "blue.store":
                             window.location.href='#/blue/marketing';
                             window.close();
                             window.location.reload(true);
                            break;
                        case "blue.marketing":
                             window.location.href='#/blue/analysis';
                             window.close();
                             window.location.reload(true);
                            break;
                    }
                },1000*60*5);

解决问题的能力在这个点有了一个小小的提升。

Code is read far more than it's written
原文地址:https://www.cnblogs.com/ChickenTang/p/6046391.html