生产服务器上的问题令人耳目一新的变化angularjs [英] Problems refreshing angularjs changes on production server

查看:95
本文介绍了生产服务器上的问题令人耳目一新的变化angularjs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,当我修改我的angularjs的应用程序时出现的反复出现的问题。现在的问题是,我要刷新页面,如果我要种子,我所做的更改。这是一个问题,因为我不希望我的用户需要刷新页面(他们可能不知道要做到这一点)。他们可能会认为该网站是坏了。是否有某种角度指令或过程中,我可以遵循,使我的生产服务器上得到体现我的用户界面的变化,而无需刷新页面我的用户?


解决方案

有一对夫妇的解决方案,你可以看看,


  1. 有一个类似的回答你的问题在​​这里:

<一个href=\"http://stackoverflow.com/questions/14718826/angularjs-disable-partial-caching-on-dev-machine\">AngularJS在开发机关闭部分缓存

要引用该帖子接受的答案:


  

这里总是自动清除缓存单程只要
  NG-查看内容的变化

  myApp.run(函数($ rootScope,$ templateCache){
   $ rootScope。在$('$ viewContentLoaded',函数(){
      $ templateCache.removeAll();
   });
});



  1. 非的角度解决方案也可以在这里找到:

强制浏览器清除缓存

要引用在该职位的最佳答案(佛明节的答案):


  

如果它以查看的CSS或js的改变的一种方法是_versionNo追加到
  的CSS / JS文件,每个版本。例如。


  
  

script_1.0.css script_1.1.css script_1.2.css等。


  
  

您可以看看这个链接,看看它如何能工作。


我希望这些帮助。

编辑。
对您的评论做出回应,对不起,上面没有奏效。

也许你可以尝试实施为基础的方法,类似于Trello一个WebSockets的,即一定的时间后,你问用户更新他们的页面接收新的系统更新或刷新,如果他们的套接字连接超时?根据设置的不同您可能会发现本教程非常有用:<一href=\"http://www.html5rocks.com/en/tutorials/frameworks/angular-websockets/\">http://www.html5rocks.com/en/tutorials/frameworks/angular-websockets/

I have a recurring issue that occurs when I make changes to my angularjs app. The problem is that I have to refresh the page if I want to seed the changes that I have made. This is a problem, because I don't want my users to have to refresh the page (they may not know to do this). They may think the site is broken. Is there some kind of angular directive or process that I can follow that will allow my UI changes to be reflected on my production server without my users having to refresh the page?

解决方案

There are a couple of solutions you could look at,

  1. There is a similar answer to your question here:

AngularJS disable partial caching on dev machine

To quote the accepted answer on that post:

"here's one way to always automatically clear the cache whenever the ng-view content changes"

myApp.run(function($rootScope, $templateCache) {
   $rootScope.$on('$viewContentLoaded', function() {
      $templateCache.removeAll();
   });
});

  1. A non angular solution may also be found here:

Force browser to clear cache

To quote the best answer on that post (Fermin's answer):

If it's to view css or js changes one way is to append _versionNo to the css/js file for each release. E.g.

script_1.0.css script_1.1.css script_1.2.css etc.

You can check out this link to see how it could work.

I hope these help.

EDIT. To respond to your comment, I'm sorry the above hasn't worked.

Perhaps you could try implementing a websockets based approach, similar to Trello, whereby after a certain amount of time you ask the user to update their page to receive new updates to the system or to refresh if their socket connection has timed out? Depending on your setup you may find this tutorial useful: http://www.html5rocks.com/en/tutorials/frameworks/angular-websockets/

这篇关于生产服务器上的问题令人耳目一新的变化angularjs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆