I use angularjs routing:
angular.module('questionModule', []). config(['$routeProvider', function ($routeProvider) { $routeProvider. when('/questions', { templateUrl: 'partials/questions.htm', controller: QuestionsController }). when('/questions/:Id', { templateUrl: 'partials/questionDetail.htm', controller: QuestionDetailCtrl }). otherwise({ redirectTo: '/questions' }); } ]);
on this page:
<html ng-app="questionModule" manifest="AngularManifest.appcache" > <head> <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script> <script src="question.js" type="text/javascript"></script> <script src="app.js" type="text/javascript"></script> <script src="appCacheBootstrap.js" type="text/javascript"></script> </head> <body> <h2>This example uses angular js routing to display partial views</h2> <div ng-view></div> </body>
However, when I make changes to one of the partial view files and update the manifest file to update the application cache, this change does not appear. I need to access chrome: // appcache-internals / and delete the application cache to see the updates. How to do it automatically? It seems that the application cache updates correctly when im is on a page that does not use routing.
Here's how I handle manifest file changes:
$(function () { if (window.applicationCache) { applicationCache.addEventListener('updateready', function () { console.log("appcache status: " + window.applicationCache.status); if (window.applicationCache.status == window.applicationCache.UPDATEREADY) { window.applicationCache.swapCache(); if (confirm('A new version of this site is available. Load it?')) { window.applicationCache.update(); window.location.reload(); } } }); } { console.log("null window.applicationCache"); } });
When I am on the routed page page, augularjs.applicatonCache is null.
source share