app/assets/javascripts/angular/angular-loader.js in angular-rails-engine-1.2.0.0 vs app/assets/javascripts/angular/angular-loader.js in angular-rails-engine-1.2.0.1

- old
+ new

@@ -1,7 +1,7 @@ /** - * @license AngularJS v1.2.0rc1 + * @license AngularJS v1.2.0 * (c) 2010-2012 Google, Inc. http://angularjs.org * License: MIT */ ( @@ -14,10 +14,12 @@ * Interface for configuring angular {@link angular.module modules}. */ function setupModuleLoader(window) { + var $injectorMinErr = minErr('$injector'); + function ensure(obj, name, factory) { return obj[name] || (obj[name] = factory()); } return ensure(ensure(window, 'angular', Object), 'module', function() { @@ -27,15 +29,19 @@ /** * @ngdoc function * @name angular.module * @description * - * The `angular.module` is a global place for creating and registering Angular modules. All - * modules (angular core or 3rd party) that should be available to an application must be + * The `angular.module` is a global place for creating, registering and retrieving Angular + * modules. + * All modules (angular core or 3rd party) that should be available to an application must be * registered using this mechanism. * + * When passed two or more arguments, a new module is created. If passed only one argument, an + * existing module (the name passed as the first argument to `module`) is retrieved. * + * * # Module * * A module is a collection of services, directives, filters, and configuration information. * `angular.module` is used to configure the {@link AUTO.$injector $injector}. * @@ -62,25 +68,26 @@ * However it's more likely that you'll just use * {@link ng.directive:ngApp ngApp} or * {@link angular.bootstrap} to simplify this process for you. * * @param {!string} name The name of the module to create or retrieve. - * @param {Array.<string>=} requires If specified then new module is being created. If unspecified then the - * the module is being retrieved for further configuration. + * @param {Array.<string>=} requires If specified then new module is being created. If + * unspecified then the the module is being retrieved for further configuration. * @param {Function} configFn Optional configuration function for the module. Same as - * {@link angular.Module#config Module#config()}. + * {@link angular.Module#methods_config Module#config()}. * @returns {module} new module with the {@link angular.Module} api. */ return function module(name, requires, configFn) { + assertNotHasOwnProperty(name, 'module'); if (requires && modules.hasOwnProperty(name)) { modules[name] = null; } return ensure(modules, name, function() { if (!requires) { - throw minErr('$injector')('nomod', "Module '{0}' is not available! You either misspelled the module name " + - "or forgot to load it. If registering a module ensure that you specify the dependencies as the second " + - "argument.", name); + throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " + + "the module name or forgot to load it. If registering a module ensure that you " + + "specify the dependencies as the second argument.", name); } /** @type {!Array.<Array.<*>>} */ var invokeQueue = []; @@ -99,11 +106,12 @@ * @ngdoc property * @name angular.Module#requires * @propertyOf angular.Module * @returns {Array.<string>} List of module names which must be loaded before this module. * @description - * Holds the list of modules which the injector will load before the current module is loaded. + * Holds the list of modules which the injector will load before the current module is + * loaded. */ requires: requires, /** * @ngdoc property @@ -118,11 +126,12 @@ /** * @ngdoc method * @name angular.Module#provider * @methodOf angular.Module * @param {string} name service name - * @param {Function} providerType Construction function for creating new instance of the service. + * @param {Function} providerType Construction function for creating new instance of the + * service. * @description * See {@link AUTO.$provide#provider $provide.provider()}. */ provider: invokeLater('$provide', 'provider'), @@ -174,18 +183,19 @@ /** * @ngdoc method * @name angular.Module#animation * @methodOf angular.Module * @param {string} name animation name - * @param {Function} animationFactory Factory function for creating new instance of an animation. + * @param {Function} animationFactory Factory function for creating new instance of an + * animation. * @description * - * **NOTE**: animations are take effect only if the **ngAnimate** module is loaded. + * **NOTE**: animations take effect only if the **ngAnimate** module is loaded. * * - * Defines an animation hook that can be later used with {@link ngAnimate.$animate $animate} service and - * directives that use this service. + * Defines an animation hook that can be later used with + * {@link ngAnimate.$animate $animate} service and directives that use this service. * * <pre> * module.animation('.animation-name', function($inject1, $inject2) { * return { * eventName : function(element, done) { @@ -217,26 +227,28 @@ /** * @ngdoc method * @name angular.Module#controller * @methodOf angular.Module - * @param {string} name Controller name. + * @param {string|Object} name Controller name, or an object map of controllers where the + * keys are the names and the values are the constructors. * @param {Function} constructor Controller constructor function. * @description * See {@link ng.$controllerProvider#register $controllerProvider.register()}. */ controller: invokeLater('$controllerProvider', 'register'), /** * @ngdoc method * @name angular.Module#directive * @methodOf angular.Module - * @param {string} name directive name + * @param {string|Object} name Directive name, or an object map of directives where the + * keys are the names and the values are the factories. * @param {Function} directiveFactory Factory function for creating new instance of * directives. * @description - * See {@link ng.$compileProvider#directive $compileProvider.directive()}. + * See {@link ng.$compileProvider#methods_directive $compileProvider.directive()}. */ directive: invokeLater('$compileProvider', 'directive'), /** * @ngdoc method @@ -279,10 +291,10 @@ */ function invokeLater(provider, method, insertMethod) { return function() { invokeQueue[insertMethod || 'push']([provider, method, arguments]); return moduleInstance; - } + }; } }); }; });