mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
docs(templateCache): reformat to conform to ngDoc
This commit is contained in:
33
js/angular/service/templateCache.js
vendored
33
js/angular/service/templateCache.js
vendored
@@ -6,17 +6,17 @@
|
||||
* @ngdoc service
|
||||
* @name $ionicTemplateCache
|
||||
* @module ionic
|
||||
* @description An angular service that preemptively caches template files to reduce flicker and boost performance.
|
||||
* @description A service that preemptively caches template files to eliminate transition flicker and boost performance.
|
||||
* @usage
|
||||
* 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');
|
||||
* in the `$state` definition
|
||||
*
|
||||
* ```js
|
||||
* angular.module('myApp', ['ionic'])
|
||||
* .config(function($stateProvider, $ionicConfigProvider) {
|
||||
@@ -54,12 +54,7 @@ IonicModule
|
||||
function($http, $templateCache, $timeout, $ionicConfig) {
|
||||
var toCache = templatesToCache,
|
||||
hasRun = false;
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $ionicTemplateCache
|
||||
* @description Add template(s) to be cached.
|
||||
* @param {string | array} string or array of strings of templates to cache.
|
||||
*/
|
||||
|
||||
function $ionicTemplateCache(templates){
|
||||
if(toCache.length > 500) return false;
|
||||
if(typeof templates === 'undefined')return run();
|
||||
@@ -98,14 +93,7 @@ function($http, $templateCache, $timeout, $ionicConfig) {
|
||||
return $ionicTemplateCache;
|
||||
}])
|
||||
|
||||
/**
|
||||
* @ngdoc config
|
||||
* @name $ionicTemplateCache
|
||||
* @module ionic
|
||||
* @private
|
||||
*
|
||||
* Intercepts the $stateprovider.state() command to look for templateUrls that can be cached
|
||||
*/
|
||||
// Intercepts the $stateprovider.state() command to look for templateUrls that can be cached
|
||||
.config([
|
||||
'$stateProvider',
|
||||
'$ionicConfigProvider',
|
||||
@@ -127,14 +115,7 @@ function($stateProvider, $ionicConfigProvider) {
|
||||
};
|
||||
}])
|
||||
|
||||
/**
|
||||
* @ngdoc run
|
||||
* @name $ionicTemplateCache
|
||||
* @module ionic
|
||||
* @private
|
||||
*
|
||||
* process the templateUrls collected by the $stateProvider, adding them to the cache
|
||||
*/
|
||||
// process the templateUrls collected by the $stateProvider, adding them to the cache
|
||||
.run(function($ionicTemplateCache) {
|
||||
$ionicTemplateCache();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user