mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
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'
}
}
});
});
```
13 lines
687 B
HTML
13 lines
687 B
HTML
<ion-view title="Facts">
|
|
<ion-content class="padding">
|
|
<p>Banging your head against a wall uses 150 calories an hour.</p>
|
|
<p>Dogs have four toes on their hind feet, and five on their front feet.</p>
|
|
<p>The ant can lift 50 times its own weight, can pull 30 times its own weight and always falls over on its right side when intoxicated.</p>
|
|
<p>A cockroach will live nine days without it's head, before it starves to death.</p>
|
|
<p>Polar bears are left handed.</p>
|
|
<p>
|
|
<a class="button icon ion-home" href="#/tab/home"> Home</a>
|
|
<a class="button icon icon-right ion-chevron-right" href="#/tab/facts2">More Facts</a>
|
|
</p>
|
|
</ion-content>
|
|
</ion-view> |