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'
}
}
});
});
```
10 lines
363 B
HTML
10 lines
363 B
HTML
<ion-view title="Home">
|
|
<ion-content class="padding">
|
|
<p>Example of Ionic tabs. Navigate to each tab, and
|
|
navigate to child views of each tab and notice how
|
|
each tab has its own navigation history.</p>
|
|
<p>
|
|
<a class="button icon icon-right ion-chevron-right" href="#/tab/facts">Scientific Facts</a>
|
|
</p>
|
|
</ion-content>
|
|
</ion-view> |