diff options
| author | Vojta Jina | 2010-11-15 01:10:16 +0000 |
|---|---|---|
| committer | Misko Hevery | 2010-11-15 21:55:37 -0800 |
| commit | cc749760fd59418433de5a055d1ca401f7500444 (patch) | |
| tree | a6bc273b68b10515b9e00bc0b166c46d88748033 /src/Angular.js | |
| parent | b467a50bc75b7f4c0d9bcee521387eda460337bf (diff) | |
| download | angular.js-cc749760fd59418433de5a055d1ca401f7500444.tar.bz2 | |
Added basic Services, which support @memberOf and @methodOf
Diffstat (limited to 'src/Angular.js')
| -rw-r--r-- | src/Angular.js | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/src/Angular.js b/src/Angular.js index e917b3ee..5a5a4ab3 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -315,7 +315,6 @@ var _undefined = undefined, */ angularValidator = extensionMap(angular, 'validator'), - /** * @ngdoc overview * @name angular.filter @@ -473,6 +472,53 @@ var _undefined = undefined, * }); */ angularFormatter = extensionMap(angular, 'formatter'), + + /** + * @ngdoc overview + * @name angular.service + * + * @description + * # Overview + * Services are substituable objects, which are wired together using dependency injection. + * Each service could have dependencies (other services), which are passed in constructor. + * Because JS is dynamicaly typed language, dependency injection can not use static types + * to satisfy these dependencies, so each service must explicitely define its dependencies. + * This is done by $inject property. + * + * For now, life time of all services is the same as the life time of page. + * + * + * # Standard services + * The Angular framework provides a standard set of services for common operations. + * You can write your own services and rewrite these standard services as well. + * Like other core angular variables, standard services always start with $. + * + * * `angular.service.$window` + * * `angular.service.$document` + * * `angular.service.$location` + * * `angular.service.$log` + * * `angular.service.$exceptionHandler` + * * `angular.service.$hover` + * * `angular.service.$invalidWidgets` + * * `angular.service.$route` + * * `angular.service.$xhr` + * * `angular.service.$xhr.error` + * * `angular.service.$xhr.bulk` + * * `angular.service.$xhr.cache` + * * `angular.service.$resource` + * * `angular.service.$cookies` + * * `angular.service.$cookieStore` + * + * # Writing your own services + * <pre> + * angular.service('notify', function(location) { + * this.one = function() { + * } + * }, {$inject: ['$location']}); + * </pre> + * + * # Using services in controller + */ angularService = extensionMap(angular, 'service'), angularCallbacks = extensionMap(angular, 'callbacks'), nodeName, |
