Commit Graph

6 Commits

Author SHA1 Message Date
Perry Govier
cb9b81d57e fix(templateCache): make sure $state is passed config options before checking what they are 2014-09-11 15:25:49 -05:00
Steven Pautz
a2377cfbb7 Fix: Explicitly list dependency so that minification works. Fixes #2050 2014-08-21 14:05:11 -04:00
Jim Cummins
1601c07291 (fix): resolve typo in usage
(fix): resolve typo in usage
Fixes typo.
No breaking changes
2014-08-15 16:40:44 -05:00
Perry Govier
359ca33024 docs(templateCache): reformat to conform to ngDoc 2014-08-15 15:48:33 -05:00
Perry Govier
e6af369aff amend(templateCache): JS lint cleanup 2014-08-15 15:15:32 -05:00
Perry Govier
944a92b08d feat(templateCache): automatically cache template files to prevent flicker on page navigation and improve performance
State templates are cached automatically, but you can optionally cache other templates.
```js
$ionicTemplateCahce('myNgIncludeTemplate.html');
```

Optionally disable all preemptive caching with the `$ionicConfigProvider` or individual states by setting `prefetchTemplate`
in the $state definition
```js
$ionicTemplateCahce('myNgIncludeTemplate.html');
```js
  angular.module('myApp', ['ionic'])
  .config(function($stateProvider, $ionicConfigProvider) {

    // disable preemptive template caching globally
    $ionicConfigProvider.prefetchTemplates(false);

    // disable individual states
    $stateProvider
      .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'
          }
        }
      });
  });
```
2014-08-15 15:10:19 -05:00