@@ -246,12 +246,27 @@ function inferInjectionArgs(fn) {
246246 * A short hand for configuring services if the `$get` method is a constant.
247247 *
248248 * @param {string } name The name of the instance. NOTE: the provider will be available under `name + 'Provide'` key.
249- * @param {function() } value The $getFn for the instance creation. Internally this is a short hand for
250- * `$provide.service(name, {$get:function(){ return value; }})`.
249+ * @param {* } value The value.
251250 * @returns {Object } registered provider instance
252251 */
253252
254253
254+ /**
255+ * @ngdoc method
256+ * @name angular.module.AUTO.$provide#constant
257+ * @methodOf angular.module.AUTO.$provide
258+ * @description
259+ *
260+ * A constant value, but unlike {@link angular.module.AUTO.$provide#value value} it can be injected
261+ * into configuration function (other modules) and it is not interceptable by
262+ * {@link angular.module.AUTO.$provide#decorator decorator}.
263+ *
264+ * @param {string } name The name of the constant.
265+ * @param {* } value The constant value.
266+ * @returns {Object } registered instance
267+ */
268+
269+
255270/**
256271 * @ngdoc method
257272 * @name angular.module.AUTO.$provide#decorator
@@ -282,6 +297,7 @@ function createInjector(modulesToLoad) {
282297 service : supportObject ( service ) ,
283298 factory : supportObject ( factory ) ,
284299 value : supportObject ( value ) ,
300+ constant : supportObject ( constant ) ,
285301 decorator : decorator
286302 }
287303 } ,
@@ -328,6 +344,11 @@ function createInjector(modulesToLoad) {
328344
329345 function value ( name , value ) { return factory ( name , valueFn ( value ) ) ; }
330346
347+ function constant ( name , value ) {
348+ providerCache [ name ] = value ;
349+ instanceCache [ name ] = value ;
350+ }
351+
331352 function decorator ( serviceName , decorFn ) {
332353 var origProvider = providerInjector . get ( serviceName + providerSuffix ) ,
333354 orig$get = origProvider . $get ;
0 commit comments