Skip to content

Commit

Permalink
feat($ionicConfigProvider): add $ionicConfigProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
ajoslin committed Aug 13, 2014
1 parent 8c6d5f2 commit 2643cff
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/docs/templates/api_menu_version.template.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@



<!-- Action Sheet -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/service/$ionicActionSheet/" class="api-section">
Expand Down Expand Up @@ -551,6 +552,11 @@
Utility
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/provider/$ionicConfigProvider/">
$ionicConfigProvider
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/utility/ionic.Platform/">
ionic.Platform
Expand Down
52 changes: 52 additions & 0 deletions js/angular/service/ionicConfig.js
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.

Copy link
@iver56

iver56 Sep 11, 2014

prefetchTemlates? Shouldn't it be prefetchTemplates?

}
return config.prefetchTemlates;
};

// private: Service definition for internal Ionic use
/**
* @ngdoc service
* @name $ionicConfig
* @module ionic
* @private
*/
this.$get = function() {
return config;
};
});

0 comments on commit 2643cff

Please sign in to comment.