angularjs を使用してシンプルなユーザー管理システムを開発しています。これは、単純な追加、更新、および削除の種類のアプリケーションです。JSON 応答を取得するために、バックエンドで spring-mvc を使用しています。Firefox、Chrome、Safariではすべて正常に動作しますが、IE..!!!!
すべてのユーザーを一覧表示する 1 つのページがあります。初めて IE9/10 で正常に動作しますが、任意のユーザーで行われた更新は (IE を使用して) ビューに反映されません。
何が起こっているのか理解できません。IE9/10もjsonデータをキャッシュし、ユーザーリストページが呼び出されるたびに、そのキャッシュされたデータをページにバインドすると思います。
ロードされたデータを IE9/10 に忘れさせることはできますか?
Web サービスにアクセスするための Angular モジュール:
angular.module("user.service", ["ngResource"]).
factory('User', function($resource, $rootScope) {
var User = $resource(
$rootScope.apipath + 'users/:userId', {userId: '@id'},
{update: {method: 'PUT'}}
);
User.prototype.isNew = function() {
return (typeof(this.id) === 'undefined');
};
return User;
});
ユーザーリスト コントローラー:
function UserListController($scope, User) {
$scope.users = User.query();
}
UserList タンプレート :
<h2><msg key="users"></msg><a class="btn btn-primary pull-right" href="#/users/new"><i class="icon-plus-sign icon-white"></i><msg key="addnew"></msg></a></h2>
<table class="table table-striped">
<tr>
<th><msg key="username"></msg></th>
<th><msg key="name"></msg></th>
<th></th>
</tr>
<tr ng-repeat="user in users">
<td>{{user.userId}}</td>
<td>{{user.contact.firstName}} {{user.contact.lastName}}</td>
<td>
<div class="pull-right">
<a class="btn btn-info" href="#/users/{{user.id}}">
<i class="icon-pencil icon-white"></i><msg key="edit"></msg>
</a>
</div>
</td>
</tr>
</table>