A service that preemptively caches template files to eliminate transition flicker and boost performance.


State templates are cached automatically, but you can optionally cache other templates.


Optionally disable all preemptive caching with the $ionicConfigProvider or individual states by setting prefetchTemplate in the $state definition

  angular.module('myApp', ['ionic'])
  .config(function($stateProvider, $ionicConfigProvider) {

    // disable preemptive template caching globally

    // disable individual states
      .state('tabs', {
        url: "/tab",
        abstract: true,
        prefetchTemplate: false,
        templateUrl: "tabs-templates/tabs.html"
      .state('tabs.home', {
        url: "/home",
        views: {
          'home-tab': {
            prefetchTemplate: false,
            templateUrl: "tabs-templates/home.html",
            controller: 'HomeTabCtrl'