简体   繁体   English

AngularJS和IE9页面刷新问题

[英]AngularJS and IE9 page refresh issue

My single page angularjs application seems to work fine in IE9+ until you edit an object and reload the page. 在编辑对象并重新加载页面之前,我的单页angularjs应用程序在IE9 +中似乎可以正常工作。 If you modify a field (change Name from "You" to "Me") then press save the server gets the update and updates the database. 如果修改字段(将“名称”从“您”更改为“我”),则按保存,服务器将获取更新并更新数据库。 If you then refresh the page the field has its original value (Name is "You"). 如果您随后刷新页面,则该字段具有其原始值(名称为“您”)。 Refreshing the page does not call the $routeProvider and does not go to the server. 刷新页面不会调用$ routeProvider,也不会转到服务器。

None of this happens on Chrome, Firefox, Safari, or their mobile counterparts. 这些都不会在Chrome,Firefox,Safari或移动设备上发生。

One of the biggest issues with IE is that it doesn't handle console.log unless the console is open and will break just about everything. IE的最大问题之一是,除非控制台打开,否则它将无法处理console.log,并且会破坏几乎所有内容。 Not sure if this is your problem, but always good to check. 不确定这是否是您的问题,但始终可以进行检查。

My server side is an ASP.Net MVC app so I disabled caching. 我的服务器端是ASP.Net MVC应用程序,因此我禁用了缓存。

Set the OutputCache attribute on the whole controller or certain actions 在整个控制器或某些操作上设置OutputCache属性

    [OutputCache(Location = OutputCacheLocation.None)]
    public class HomeController : Controller
    {  
        //All actions in here won't be cached.
    }

Used @KCD's answer from this question: 使用@KCD在此问题上的答案:

How do I add site-wide no-cache headers to an MVC 3 app 如何将站点范围的无缓存标头添加到MVC 3应用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM