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'
}
}
});
});
```
15 lines
460 B
HTML
15 lines
460 B
HTML
<ion-tabs class="tabs-icon-top tabs-positive">
|
|
|
|
<ion-tab title="Home" icon="ion-home" href="#/tab/home">
|
|
<ion-nav-view name="home-tab"></ion-nav-view>
|
|
</ion-tab>
|
|
|
|
<ion-tab title="About" icon="ion-ios7-information" href="#/tab/about">
|
|
<ion-nav-view name="about-tab"></ion-nav-view>
|
|
</ion-tab>
|
|
|
|
<ion-tab title="Contact" icon="ion-ios7-world" ui-sref="tabs.contact">
|
|
<ion-nav-view name="contact-tab"></ion-nav-view>
|
|
</ion-tab>
|
|
|
|
</ion-tabs> |