From 92af30ce6e99676c71c85bd08962b68629564908 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Sun, 15 Jan 2012 23:28:10 -0800 Subject: docs(*): various doc fixes --- src/Injector.js | 14 +++++++------- src/angular-mocks.js | 4 ++-- src/directives.js | 3 ++- src/loader.js | 30 ++++++++++++++++++------------ src/service/resource.js | 7 ++----- src/service/scope.js | 3 ++- 6 files changed, 33 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/Injector.js b/src/Injector.js index cebc6eed..849ef3b9 100644 --- a/src/Injector.js +++ b/src/Injector.js @@ -75,7 +75,7 @@ function inferInjectionArgs(fn) { *
  *   var $injector = angular.injector();
  *   expect($injector.get('$injector')).toBe($injector);
- *   expect($injector.invoke(null, function($injector){
+ *   expect($injector.invoke(function($injector){
  *     return $injector;
  *   }).toBe($injector);
  * 
@@ -182,7 +182,7 @@ function inferInjectionArgs(fn) { * * describe('Greeter', function(){ * - * beforeEach(inject(function($provide) { + * beforeEach(module(function($provide) { * $provide.service('greet', GreetProvider); * }); * @@ -190,13 +190,13 @@ function inferInjectionArgs(fn) { * expect(greet('angular')).toEqual('Hello angular!'); * })); * - * it('should allow configuration of salutation', inject( - * function(greetProvider) { + * it('should allow configuration of salutation', function() { + * module(function(greetProvider) { * greetProvider.salutation('Ahoj'); - * }, - * function(greet) { + * }); + * inject(function(greet) { * expect(greet('angular')).toEqual('Ahoj angular!'); - * } + * }); * )}; * * }); diff --git a/src/angular-mocks.js b/src/angular-mocks.js index 0e6c5143..516259b8 100644 --- a/src/angular-mocks.js +++ b/src/angular-mocks.js @@ -1476,7 +1476,7 @@ window.jasmine && (function(window) { * @name angular.mock.module * @description * - * *NOTE*: This is function is also published on window for easy access. + * *NOTE*: This is function is also published on window for easy access.
* *NOTE*: Only available with {@link http://pivotal.github.com/jasmine/ jasmine}. * * This function registers a module configuration code. It collects the configuration information @@ -1511,7 +1511,7 @@ window.jasmine && (function(window) { * @name angular.mock.inject * @description * - * *NOTE*: This is function is also published on window for easy access. + * *NOTE*: This is function is also published on window for easy access.
* *NOTE*: Only available with {@link http://pivotal.github.com/jasmine/ jasmine}. * * The inject function wraps a function into an injectable function. The inject() creates new diff --git a/src/directives.js b/src/directives.js index 6e565b83..1d5b36f2 100644 --- a/src/directives.js +++ b/src/directives.js @@ -111,7 +111,8 @@ angularDirective("ng:init", function(expression){ this.contacts.push({type:'email', value:'yourname@example.org'}); }, removeContact: function(contactToRemove) { - angular.module.ng.$filter.remove(this.contacts, contactToRemove); + var index = this.contacts.indexOf(contactToRemove); + this.contacts.splice(index, 1); }, clearContact: function(contact) { contact.type = 'phone'; diff --git a/src/loader.js b/src/loader.js index e6662aae..69ae024f 100644 --- a/src/loader.js +++ b/src/loader.js @@ -24,38 +24,43 @@ function setupModuleLoader(window) { * @description * * The `angular.module` is a global place for registering angular modules. All modules - * (angular core or 3rd party) that should be available to an application must be registered using this mechanism. + * (angular core or 3rd party) that should be available to an application must be registered + * using this mechanism. + * * * # Module * - * A module is a collocation of services, directives, filters, and configure information. Module is used to configure the, - * {@link angular.module.AUTO.$injector $injector}. + * A module is a collocation of services, directives, filters, and configure information. Module + * is used to configure the {@link angular.module.AUTO.$injector $injector}. * *
      * // Create a new module
      * var myModule = angular.module('myModule', []);
      *
-     * // configure a new service
+     * // register a new service
      * myModule.value('appName', 'MyCoolApp');
      *
      * // configure existing services inside initialization blocks.
-     * myModule.init(function($locationProvider) {
+     * myModule.config(function($locationProvider) {
      *   // Configure existing providers
-     *   $locationProvider.hashPrefix = '!';
+     *   $locationProvider.hashPrefix('!');
      * });
      * 
* - * Then you can load your module like this: + * Then you can create an injector and load your modules like this: * *
      * var injector = angular.injector(['ng', 'MyModule'])
      * 
* + * However it's more likely that you'll just use {@link angular.directive.ng:app ng:app} or + * {@link angular.bootstrap} to simplify this process for you. + * * @param {!string} name The name of the module to create or retrieve. * @param {Array.=} requires If specified then new module is being created. If unspecified then the * the module is being retrieved for further configuration. - * @param {Function} initFn Option configuration function for the module. Same as - * {@link angular.Module#init Module.init()}. + * @param {Function} configFn Option configuration function for the module. Same as + * {@link angular.Module#config Module#config()}. * @return {angular.Module} */ return function module(name, requires, configFn) { @@ -149,8 +154,8 @@ function setupModuleLoader(window) { * @ngdoc method * @name angular.Module#config * @methodOf angular.Module - * @param {Function} initializationFn Execute this function on module load. Useful for - * service configuration. + * @param {Function} configFn Execute this function on module load. Useful for service + * configuration. * @description * Use this method to register work which needs to be performed on module loading. */ @@ -163,7 +168,8 @@ function setupModuleLoader(window) { * @param {Function} initializationFn Execute this function after injector creation. * Useful for application initialization. * @description - * Use this method to register work which needs to be performed on module loading. + * Use this method to register work which needs to be performed when the injector with + * with the current module is finished loading. */ run: function(block) { runBlocks.push(block); diff --git a/src/service/resource.js b/src/service/resource.js index 8596c1df..d2b722c2 100644 --- a/src/service/resource.js +++ b/src/service/resource.js @@ -30,8 +30,8 @@ * @param {Object.=} actions Hash with declaration of custom action that should extend the * default set of resource actions. The declaration should be created in the following format: * - * {action1: {method:?, params:?, isArray:?, verifyCache:?}, - * action2: {method:?, params:?, isArray:?, verifyCache:?}, + * {action1: {method:?, params:?, isArray:?}, + * action2: {method:?, params:?, isArray:?}, * ...} * * Where: @@ -43,9 +43,6 @@ * - `params` – {object=} – Optional set of pre-bound parameters for this action. * - isArray – {boolean=} – If true then the returned object for this action is an array, see * `returns` section. - * - verifyCache – {boolean=} – If true then whenever cache hit occurs, the object is returned and - * an async request will be made to the server and the resources as well as the cache will be - * updated when the response is received. * * @returns {Object} A resource "class" object with methods for the default set of resource actions * optionally extended with custom `actions`. The default set contains these actions: diff --git a/src/service/scope.js b/src/service/scope.js index a19bf83e..fe72c953 100644 --- a/src/service/scope.js +++ b/src/service/scope.js @@ -212,7 +212,8 @@ function $RootScopeProvider(){ * * # Example
-           var scope = angular.module.ng.$rootScope.Scope();
+           // let's assume that scope was dependency injected as the $rootScope
+           var scope = $rootScope;
            scope.name = 'misko';
            scope.counter = 0;
 
-- 
cgit v1.2.3