-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat($ionicConfigProvider): add $ionicConfigProvider
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* @ngdoc provider | ||
* @name $ionicConfigProvider | ||
* @module ionic | ||
* @description $ionicConfigProvider can be used during the configuration phase of your app | ||
* to change how Ionic works. | ||
* | ||
* @usage | ||
* ```js | ||
* var myApp = angular.module('reallyCoolApp', ['ionic']); | ||
* | ||
* myApp.config(function($ionicConfigProvider) { | ||
* $ionicConfigProvider.prefetchTemplates(false); | ||
* }); | ||
* ``` | ||
*/ | ||
IonicModule | ||
.provider('$ionicConfig', function() { | ||
|
||
var provider = this; | ||
var config = { | ||
prefetchTemplates: true | ||
}; | ||
|
||
/** | ||
* @ngdoc method | ||
* @name $ionicConfigProvider#prefetchTemplates | ||
* @description Set whether Ionic should prefetch all templateUrls defined in | ||
* $stateProvider.state. Default true. If set to false, the user will have to wait | ||
* for a template to be fetched the first time he/she is going to a a new page. | ||
* @param shouldPrefetch Whether Ionic should prefetch templateUrls defined in | ||
* `$stateProvider.state()`. Default true. | ||
* @returns {boolean} Whether Ionic will prefetch templateUrls defined in $stateProvider.state. | ||
*/ | ||
this.prefetchTemplates = function(newValue) { | ||
if (arguments.length) { | ||
config.prefetchTemlates = newValue; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
} | ||
return config.prefetchTemlates; | ||
}; | ||
|
||
// private: Service definition for internal Ionic use | ||
/** | ||
* @ngdoc service | ||
* @name $ionicConfig | ||
* @module ionic | ||
* @private | ||
*/ | ||
this.$get = function() { | ||
return config; | ||
}; | ||
}); |
prefetchTemlates? Shouldn't it be prefetchTemplates?