title: AngularJS - iterate all cached partials
body: <p>I have routing set up via $routeProvider, something like</p>
  
  <pre><code>$routeProvider.when('/page/:id', 
  {templateUrl: 'partials/public/view/page.html', controller: XYZ});
  </code></pre>
  
  <p>On first page load, I'd like to iterate through cached partials and remove them. Initially I've tried:</p>
  
  <pre><code>$templateCache.removeAll()
  </code></pre>
  
  <p>called when parent controller (declared over entire body element) is first created - aka page load. Which seems to work, but some 3rd party plugins (directives) then throw error</p>
  
  <pre><code>Error: Failed to load template: template/tabs/tab.html
  </code></pre>
  
  <p>I know I can remove one partial cache at a time using $templateCache.remove(key) but I don't like the idea of hardcoding all partials keys in some custom clear function. Instead, I'd like to get all cached partials and if key starts with some string, then remove it. My question is, is there a way to iterate all cached partials?</p>