Thursday 15 August 2013

spring mvc - Data not updating on ie 9/10 in application developed using angularjs -


I am developing a simple user management system that is using gliarries. It's easy to add, update and delete the type of application. I am using Spring-MVC in back-end to get a JSON response. Everything is fine in Firefox, Chrome and Safari but IE .. !!!!

I have a page that lists all users for the first time it will work fine in IE9 / 10 but not seeing any updates made to any user (using IE) is not reflected Will happen.

I am not able to understand what is happening. I think IE 9/10 will also censor JSN data, and every time the user list page is called, it will bind the cached data to the page.

Is it possible to forget the loaded data on IE 9/10? / P>

The angular module for accessing the web-service:

  angular.module ("user.service", ["ngResource"]). Factory ('user', function ($ resource, $ rootsecope) {var user = $ resource ($ rootScope.apipath + 'user /: userId', {userId: '@id'}, {update: {method: 'PUT '}}) ;; User.prototype.isNew = function () {returns (typef (this.id) ===' undefined ');}; return user;}); User License Controller ($ Scope, User) {$ scope.users = User.query ( );   

UserList Tamplate:

  & lt; H2 & gt; & Lt; Msgkey = "user" & gt; & Lt; / Msg & gt; & Lt; One class = "btn btn-primary pull-right" href = "# / user / new" & gt; & Lt; I class = "icon-plus-mark mark-white" & gt; & Lt; / I & gt; & Lt; Msgkey = "addnew" & gt; & Lt; / Msg & gt; & Lt; / A & gt; & Lt; / H2 & gt; & Lt; Table class = "table-striped" & gt; & Lt; TR & gt; & Lt; Th & gt; & Lt; Msgkey = "user name" & gt; & Lt; / Msg & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; Msg key = "name" & gt; & Lt; / Msg & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt; / Th & gt; & Lt; / TR & gt; & Lt; Tr ng-repeat = "user in user" & gt; & Lt; TD & gt; {{User.userId}} & lt; / TD & gt; & Lt; Td> {{User.contact.firstName}} {{user.contact.lastName}} & lt; / Td> & Lt; TD & gt; & Lt; Div class = "pull-right" & gt; & Lt; A class = "BTN BTN-notification" href = "# / user / {{user.id}}" & gt; & Lt; I class = "icon-pencil icon-white" & gt; & Lt; / I & gt; & Lt; Msg key = "edit" & gt; & Lt; / Msg & gt; & Lt; / A & gt; & Lt; / Div & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt;    

We are developing large AngularJs applications and with caching of IE Issues are also underway. The API Fix Message was the absolute fix for adding cache control headers.

  Cache-control: no-store   

Another option is to create an HTTP interceptor that engages a unique timestamp, so each request is different Is and is not cached.

Example of post code

  var AppInfrastructure = angular.module ('App.Infrastructure', []); AppInfrastructure .config (function ($ httpProvider) {$ httpProvider.requestInterceptors.push ('httpRequestInterceptorCacheBuster');}) .Feature ('httpRequestInterceptorCacheBuster', function () {Return Function (Promise) {Return Promise. Then (function (request) {If (request.method === 'GET') {var sep = request.url.indexOf ('?') === -1 '?': '& Amp;'; request.url = request.url + Sep + 'cacheSlayer =' + new date (). GetTime ();} Return request;});};});    

No comments:

Post a Comment