@angular-wave/angular.ts 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,711 @@
1
+ /\*\*
2
+
3
+ - @ngdoc function
4
+ - @module ng
5
+ - @name angular.injector
6
+ - @kind function
7
+ -
8
+ - @description
9
+ - Creates an injector object that can be used for retrieving services as well as for
10
+ - dependency injection (see {@link guide/di dependency injection}).
11
+ -
12
+ - @param {Array.<string|Function>} modules A list of module functions or their aliases. See
13
+ - {@link angular.module}. The `ng` module must be explicitly added.
14
+ - @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which
15
+ - disallows argument name annotation inference.
16
+ - @returns {injector} Injector object. See {@link auto.$injector $injector}.
17
+ -
18
+ - @example
19
+ - Typical usage
20
+ - ```js
21
+
22
+ ```
23
+ - // create an injector
24
+ - var $injector = angular.injector(['ng']);
25
+ -
26
+ - // use the injector to kick off your application
27
+ - // use the type inference to auto inject arguments, or use implicit injection
28
+ - $injector.invoke(function($rootScope, $compile, $document) {
29
+ - $compile($document)($rootScope);
30
+ - $rootScope.$digest();
31
+ - });
32
+ - ```
33
+
34
+ ```
35
+ -
36
+ - Sometimes you want to get access to the injector of a currently running AngularJS app
37
+ - from outside AngularJS. Perhaps, you want to inject and compile some markup after the
38
+ - application has been bootstrapped. You can do this using the extra `injector()` added
39
+ - to JQuery/jqLite elements. See {@link angular.element}.
40
+ -
41
+ - \*This is fairly rare but could be the case if a third party library is injecting the
42
+ - markup.\*
43
+ -
44
+ - In the following example a new block of HTML containing a `ng-controller`
45
+ - directive is added to the end of the document body by JQuery. We then compile and link
46
+ - it into the current AngularJS scope.
47
+ -
48
+ - ```js
49
+
50
+ ```
51
+ - var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>');
52
+ - $(document.body).append($div);
53
+ -
54
+ - angular.element(document).injector().invoke(function($compile) {
55
+ - var scope = angular.element($div).scope();
56
+ - $compile($div)(scope);
57
+ - });
58
+ - ```
59
+ */
60
+ ```
61
+
62
+ /\*\*
63
+
64
+ - @ngdoc module
65
+ - @name auto
66
+ - @installation
67
+ - @description
68
+ -
69
+ - Implicit module which gets automatically added to each {@link auto.$injector $injector}.
70
+ \*/
71
+
72
+ ///////////////////////////////////////
73
+
74
+ /\*\*
75
+
76
+ - @ngdoc service
77
+ - @name $injector
78
+ -
79
+ - @description
80
+ -
81
+ - `$injector` is used to retrieve object instances as defined by
82
+ - {@link auto.$provide provider}, instantiate types, invoke methods,
83
+ - and load modules.
84
+ -
85
+ - The following always holds true:
86
+ -
87
+ - ```js
88
+
89
+ ```
90
+ - var $injector = angular.injector();
91
+ - expect($injector.get('$injector')).toBe($injector);
92
+ - expect($injector.invoke(function($injector) {
93
+ - return $injector;
94
+ - })).toBe($injector);
95
+ - ```
96
+
97
+ ```
98
+ -
99
+ - ## Injection Function Annotation
100
+ -
101
+ - JavaScript does not have annotations, and annotations are needed for dependency injection. The
102
+ - following are all valid ways of annotating function with injection arguments and are equivalent.
103
+ -
104
+ - ```js
105
+
106
+ ```
107
+ - // inferred (only works if code not minified/obfuscated)
108
+ - $injector.invoke(function(serviceA){});
109
+ -
110
+ - // annotated
111
+ - function explicit(serviceA) {};
112
+ - explicit.$inject = ['serviceA'];
113
+ - $injector.invoke(explicit);
114
+ -
115
+ - // inline
116
+ - $injector.invoke(['serviceA', function(serviceA){}]);
117
+ - ```
118
+
119
+ ```
120
+ -
121
+ - ### Inference
122
+ -
123
+ - In JavaScript calling `toString()` on a function returns the function definition. The definition
124
+ - can then be parsed and the function arguments can be extracted. This method of discovering
125
+ - annotations is disallowed when the injector is in strict mode.
126
+ - _NOTE:_ This does not work with minification, and obfuscation tools since these tools change the
127
+ - argument names.
128
+ -
129
+ - ### `$inject` Annotation
130
+ - By adding an `$inject` property onto a function the injection parameters can be specified.
131
+ -
132
+ - ### Inline
133
+ - As an array of injection names, where the last item in the array is the function to call.
134
+ \*/
135
+
136
+ /\*\*
137
+
138
+ - @ngdoc property
139
+ - @name $injector#modules
140
+ - @type {Object}
141
+ - @description
142
+ - A hash containing all the modules that have been loaded into the
143
+ - $injector.
144
+ -
145
+ - You can use this property to find out information about a module via the
146
+ - {@link angular.Module#info `myModule.info(...)`} method.
147
+ -
148
+ - For example:
149
+ -
150
+ - ```
151
+
152
+ ```
153
+ - var info = $injector.modules['ngAnimate'].info();
154
+ - ```
155
+
156
+ ```
157
+ -
158
+ - \*\*Do not use this property to attempt to modify the modules after the application
159
+ - has been bootstrapped.\*\*
160
+ \*/
161
+
162
+ /\*\*
163
+
164
+ - @ngdoc method
165
+ - @name $injector#get
166
+ -
167
+ - @description
168
+ - Return an instance of the service.
169
+ -
170
+ - @param {string} name The name of the instance to retrieve.
171
+ - @param {string=} caller An optional string to provide the origin of the function call for error messages.
172
+ - @return {_} The instance.
173
+ _/
174
+
175
+ /\*\*
176
+
177
+ - @ngdoc method
178
+ - @name $injector#invoke
179
+ -
180
+ - @description
181
+ - Invoke the method and supply the method arguments from the `$injector`.
182
+ -
183
+ - @param {Function|Array.<string|Function>} fn The injectable function to invoke. Function parameters are
184
+ - injected according to the {@link guide/di $inject Annotation} rules.
185
+ - @param {Object=} self The `this` for the invoked method.
186
+ - @param {Object=} locals Optional object. If preset then any argument names are read from this
187
+ - object first, before the `$injector` is consulted.
188
+ - @returns {_} the value returned by the invoked `fn` function.
189
+ _/
190
+
191
+ /\*\*
192
+
193
+ - @ngdoc method
194
+ - @name $injector#has
195
+ -
196
+ - @description
197
+ - Allows the user to query if the particular service exists.
198
+ -
199
+ - @param {string} name Name of the service to query.
200
+ - @returns {boolean} `true` if injector has given service.
201
+ \*/
202
+
203
+ /\*\*
204
+
205
+ - @ngdoc method
206
+ - @name $injector#instantiate
207
+ - @description
208
+ - Create a new instance of JS type. The method takes a constructor function, invokes the new
209
+ - operator, and supplies all of the arguments to the constructor function as specified by the
210
+ - constructor annotation.
211
+ -
212
+ - @param {Function} Type Annotated constructor function.
213
+ - @param {Object=} locals Optional object. If preset then any argument names are read from this
214
+ - object first, before the `$injector` is consulted.
215
+ - @returns {Object} new instance of `Type`.
216
+ \*/
217
+
218
+ /\*\*
219
+
220
+ - @ngdoc method
221
+ - @name $injector#annotate
222
+ -
223
+ - @description
224
+ - Returns an array of service names which the function is requesting for injection. This API is
225
+ - used by the injector to determine which services need to be injected into the function when the
226
+ - function is invoked. There are three ways in which the function can be annotated with the needed
227
+ - dependencies.
228
+ -
229
+ - #### Argument names
230
+ -
231
+ - The simplest form is to extract the dependencies from the arguments of the function. This is done
232
+ - by converting the function into a string using `toString()` method and extracting the argument
233
+ - names.
234
+ - ```js
235
+
236
+ ```
237
+ - // Given
238
+ - function MyController($scope, $route) {
239
+ - // ...
240
+ - }
241
+ -
242
+ - // Then
243
+ - expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
244
+ - ```
245
+
246
+ ```
247
+ -
248
+ - You can disallow this method by using strict injection mode.
249
+ -
250
+ - This method does not work with code minification / obfuscation. For this reason the following
251
+ - annotation strategies are supported.
252
+ -
253
+ - #### The `$inject` property
254
+ -
255
+ - If a function has an `$inject` property and its value is an array of strings, then the strings
256
+ - represent names of services to be injected into the function.
257
+ - ```js
258
+
259
+ ```
260
+ - // Given
261
+ - var MyController = function(obfuscatedScope, obfuscatedRoute) {
262
+ - // ...
263
+ - }
264
+ - // Define function dependencies
265
+ - MyController['$inject'] = ['$scope', '$route'];
266
+ -
267
+ - // Then
268
+ - expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
269
+ - ```
270
+
271
+ ```
272
+ -
273
+ - #### The array notation
274
+ -
275
+ - It is often desirable to inline Injected functions and that's when setting the `$inject` property
276
+ - is very inconvenient. In these situations using the array notation to specify the dependencies in
277
+ - a way that survives minification is a better choice:
278
+ -
279
+ - ```js
280
+
281
+ ```
282
+ - // We wish to write this (not minification / obfuscation safe)
283
+ - injector.invoke(function($compile, $rootScope) {
284
+ - // ...
285
+ - });
286
+ -
287
+ - // We are forced to write break inlining
288
+ - var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {
289
+ - // ...
290
+ - };
291
+ - tmpFn.$inject = ['$compile', '$rootScope'];
292
+ - injector.invoke(tmpFn);
293
+ -
294
+ - // To better support inline function the inline annotation is supported
295
+ - injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {
296
+ - // ...
297
+ - }]);
298
+ -
299
+ - // Therefore
300
+ - expect(injector.annotate(
301
+ - ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
302
+ - ).toEqual(['$compile', '$rootScope']);
303
+ - ```
304
+
305
+ ```
306
+ -
307
+ - @param {Function|Array.<string|Function>} fn Function for which dependent service names need to
308
+ - be retrieved as described above.
309
+ -
310
+ - @param {boolean=} [strictDi=false] Disallow argument name annotation inference.
311
+ -
312
+ - @returns {Array.<string>} The names of the services which the function requires.
313
+ \*/
314
+ /\*\*
315
+ - @ngdoc method
316
+ - @name $injector#loadNewModules
317
+ -
318
+ - @description
319
+ -
320
+ - Add the specified modules to the current injector.
321
+ -
322
+ - This method will add each of the injectables to the injector and execute all of the config and run
323
+ - blocks for each module passed to the method.
324
+ -
325
+ - If a module has already been loaded into the injector then it will not be loaded again.
326
+ -
327
+ - - The application developer is responsible for loading the code containing the modules; and for
328
+ - ensuring that lazy scripts are not downloaded and executed more often that desired.
329
+ - - Previously compiled HTML will not be affected by newly loaded directives, filters and components.
330
+ - - Modules cannot be unloaded.
331
+ -
332
+ - You can use {@link $injector#modules `$injector.modules`} to check whether a module has been loaded
333
+ - into the injector, which may indicate whether the script has been executed already.
334
+ -
335
+ - @example
336
+ - Here is an example of loading a bundle of modules, with a utility method called `getScript`:
337
+ -
338
+ - ```javascript
339
+
340
+ ```
341
+ - app.factory('loadModule', function($injector) {
342
+ - return function loadModule(moduleName, bundleUrl) {
343
+ - return getScript(bundleUrl).then(function() { $injector.loadNewModules([moduleName]); });
344
+ - };
345
+ - })
346
+ - ```
347
+
348
+ ```
349
+ -
350
+ - @param {Array<String|Function|Array>=} mods an array of modules to load into the application.
351
+ - Each item in the array should be the name of a predefined module or a (DI annotated)
352
+ - function that will be invoked by the injector as a `config` block.
353
+ - See: {@link angular.module modules}
354
+ \*/
355
+
356
+ /\*\*
357
+
358
+ - @ngdoc service
359
+ - @name $provide
360
+ -
361
+ - @description
362
+ -
363
+ - The {@link auto.$provide $provide} service has a number of methods for registering components
364
+ - with the {@link auto.$injector $injector}. Many of these functions are also exposed on
365
+ - {@link angular.Module}.
366
+ -
367
+ - An AngularJS **service** is a singleton object created by a **service factory**. These \*\*service
368
+ - factories** are functions which, in turn, are created by a **service provider\*\*.
369
+ - The **service providers** are constructor functions. When instantiated they must contain a
370
+ - property called `$get`, which holds the **service factory** function.
371
+ -
372
+ - When you request a service, the {@link auto.$injector $injector} is responsible for finding the
373
+ - correct **service provider**, instantiating it and then calling its `$get` **service factory**
374
+ - function to get the instance of the **service**.
375
+ -
376
+ - Often services have no configuration options and there is no need to add methods to the service
377
+ - provider. The provider will be no more than a constructor function with a `$get` property. For
378
+ - these cases the {@link auto.$provide $provide} service has additional helper methods to register
379
+ - services without specifying a provider.
380
+ -
381
+ - - {@link auto.$provide#provider provider(name, provider)} - registers a **service provider** with the
382
+ - {@link auto.$injector $injector}
383
+ - - {@link auto.$provide#constant constant(name, obj)} - registers a value/object that can be accessed by
384
+ - providers and services.
385
+ - - {@link auto.$provide#value value(name, obj)} - registers a value/object that can only be accessed by
386
+ - services, not providers.
387
+ - - {@link auto.$provide#factory factory(name, fn)} - registers a service **factory function**
388
+ - that will be wrapped in a **service provider** object, whose `$get` property will contain the
389
+ - given factory function.
390
+ - - {@link auto.$provide#service service(name, Fn)} - registers a **constructor function**
391
+ - that will be wrapped in a **service provider** object, whose `$get` property will instantiate
392
+ - a new object using the given constructor function.
393
+ - - {@link auto.$provide#decorator decorator(name, decorFn)} - registers a **decorator function** that
394
+ - will be able to modify or replace the implementation of another service.
395
+ -
396
+ - See the individual methods for more information and examples.
397
+ \*/
398
+
399
+ /\*\*
400
+
401
+ - @ngdoc method
402
+ - @name $provide#provider
403
+ - @description
404
+ -
405
+ - Register a **provider function** with the {@link auto.$injector $injector}. Provider functions
406
+ - are constructor functions, whose instances are responsible for "providing" a factory for a
407
+ - service.
408
+ -
409
+ - Service provider names start with the name of the service they provide followed by `Provider`.
410
+ - For example, the {@link ng.$log $log} service has a provider called
411
+ - {@link ng.$logProvider $logProvider}.
412
+ -
413
+ - Service provider objects can have additional methods which allow configuration of the provider
414
+ - and its service. Importantly, you can configure what kind of service is created by the `$get`
415
+ - method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a
416
+ - method {@link ng.$logProvider#debugEnabled debugEnabled}
417
+ - which lets you specify whether the {@link ng.$log $log} service will log debug messages to the
418
+ - console or not.
419
+ -
420
+ - It is possible to inject other providers into the provider function,
421
+ - but the injected provider must have been defined before the one that requires it.
422
+ -
423
+ - @param {string} name The name of the instance. NOTE: the provider will be available under `name +
424
+ 'Provider'` key.
425
+ - @param {(Object|function())} provider If the provider is:
426
+ -
427
+ - - `Object`: then it should have a `$get` method. The `$get` method will be invoked using
428
+ - {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created.
429
+ - - `Constructor`: a new instance of the provider will be created using
430
+ - {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`.
431
+ -
432
+ - @returns {Object} registered provider instance
433
+
434
+ - @example
435
+ -
436
+ - The following example shows how to create a simple event tracking service and register it using
437
+ - {@link auto.$provide#provider $provide.provider()}.
438
+ -
439
+ - ```js
440
+
441
+ ```
442
+ - // Define the eventTracker provider
443
+ - function EventTrackerProvider() {
444
+ - var trackingUrl = '/track';
445
+ -
446
+ - // A provider method for configuring where the tracked events should been saved
447
+ - this.setTrackingUrl = function(url) {
448
+ - trackingUrl = url;
449
+ - };
450
+ -
451
+ - // The service factory function
452
+ - this.$get = ['$http', function($http) {
453
+ - var trackedEvents = {};
454
+ - return {
455
+ - // Call this to track an event
456
+ - event: function(event) {
457
+ - var count = trackedEvents[event] || 0;
458
+ - count += 1;
459
+ - trackedEvents[event] = count;
460
+ - return count;
461
+ - },
462
+ - // Call this to save the tracked events to the trackingUrl
463
+ - save: function() {
464
+ - $http.post(trackingUrl, trackedEvents);
465
+ - }
466
+ - };
467
+ - }];
468
+ - }
469
+ -
470
+ - describe('eventTracker', function() {
471
+ - var postSpy;
472
+ -
473
+ - beforeEach(module(function($provide) {
474
+ - // Register the eventTracker provider
475
+ - $provide.provider('eventTracker', EventTrackerProvider);
476
+ - }));
477
+ -
478
+ - beforeEach(module(function(eventTrackerProvider) {
479
+ - // Configure eventTracker provider
480
+ - eventTrackerProvider.setTrackingUrl('/custom-track');
481
+ - }));
482
+ -
483
+ - it('tracks events', inject(function(eventTracker) {
484
+ - expect(eventTracker.event('login')).toEqual(1);
485
+ - expect(eventTracker.event('login')).toEqual(2);
486
+ - }));
487
+ -
488
+ - it('saves to the tracking url', inject(function(eventTracker, $http) {
489
+ - postSpy = spyOn($http, 'post');
490
+ - eventTracker.event('login');
491
+ - eventTracker.save();
492
+ - expect(postSpy).toHaveBeenCalled();
493
+ - expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');
494
+ - expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');
495
+ - expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });
496
+ - }));
497
+ - });
498
+ - ```
499
+ */
500
+ ```
501
+
502
+ /\*\*
503
+
504
+ - @ngdoc method
505
+ - @name $provide#factory
506
+ - @description
507
+ -
508
+ - Register a **service factory**, which will be called to return the service instance.
509
+ - This is short for registering a service where its provider consists of only a `$get` property,
510
+ - which is the given service factory function.
511
+ - You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to
512
+ - configure your service in a provider.
513
+ -
514
+ - @param {string} name The name of the instance.
515
+ - @param {Function|Array.<string|Function>} $getFn The injectable $getFn for the instance creation.
516
+ - Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`.
517
+ - @returns {Object} registered provider instance
518
+ -
519
+ - @example
520
+ - Here is an example of registering a service
521
+ - ```js
522
+
523
+ ```
524
+ - $provide.factory('ping', ['$http', function($http) {
525
+ - return function ping() {
526
+ - return $http.send('/ping');
527
+ - };
528
+ - }]);
529
+ - ```
530
+
531
+ ```
532
+ - You would then inject and use this service like this:
533
+ - ```js
534
+
535
+ ```
536
+ - someModule.controller('Ctrl', ['ping', function(ping) {
537
+ - ping();
538
+ - }]);
539
+ - ```
540
+ */
541
+ ```
542
+
543
+ /\*\*
544
+
545
+ - @ngdoc method
546
+ - @name $provide#service
547
+ - @description
548
+ -
549
+ - Register a **service constructor**, which will be invoked with `new` to create the service
550
+ - instance.
551
+ - This is short for registering a service where its provider's `$get` property is a factory
552
+ - function that returns an instance instantiated by the injector from the service constructor
553
+ - function.
554
+ -
555
+ - Internally it looks a bit like this:
556
+ -
557
+ - ```
558
+
559
+ ```
560
+ - {
561
+ - $get: function() {
562
+ - return $injector.instantiate(constructor);
563
+ - }
564
+ - }
565
+ - ```
566
+
567
+ ```
568
+ -
569
+ -
570
+ - You should use {@link auto.$provide#service $provide.service(class)} if you define your service
571
+ - as a type/class.
572
+ -
573
+ - @param {string} name The name of the instance.
574
+ - @param {Function|Array.<string|Function>} constructor An injectable class (constructor function)
575
+ - that will be instantiated.
576
+ - @returns {Object} registered provider instance
577
+ -
578
+ - @example
579
+ - Here is an example of registering a service using
580
+ - {@link auto.$provide#service $provide.service(class)}.
581
+ - ```js
582
+
583
+ ```
584
+ - var Ping = function($http) {
585
+ - this.$http = $http;
586
+ - };
587
+ -
588
+ - Ping.$inject = ['$http'];
589
+ -
590
+ - Ping.prototype.send = function() {
591
+ - return this.$http.get('/ping');
592
+ - };
593
+ - $provide.service('ping', Ping);
594
+ - ```
595
+
596
+ ```
597
+ - You would then inject and use this service like this:
598
+ - ```js
599
+
600
+ ```
601
+ - someModule.controller('Ctrl', ['ping', function(ping) {
602
+ - ping.send();
603
+ - }]);
604
+ - ```
605
+ */
606
+ ```
607
+
608
+ /\*\*
609
+
610
+ - @ngdoc method
611
+ - @name $provide#value
612
+ - @description
613
+ -
614
+ - Register a **value service** with the {@link auto.$injector $injector}, such as a string, a
615
+ - number, an array, an object or a function. This is short for registering a service where its
616
+ - provider's `$get` property is a factory function that takes no arguments and returns the \*\*value
617
+ - service\*\*. That also means it is not possible to inject other services into a value service.
618
+ -
619
+ - Value services are similar to constant services, except that they cannot be injected into a
620
+ - module configuration function (see {@link angular.Module#config}) but they can be overridden by
621
+ - an AngularJS {@link auto.$provide#decorator decorator}.
622
+ -
623
+ - @param {string} name The name of the instance.
624
+ - @param {\*} value The value.
625
+ - @returns {Object} registered provider instance
626
+ -
627
+ - @example
628
+ - Here are some examples of creating value services.
629
+ - ```js
630
+
631
+ ```
632
+ - $provide.value('ADMIN_USER', 'admin');
633
+ -
634
+ - $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });
635
+ -
636
+ - $provide.value('halfOf', function(value) {
637
+ - return value / 2;
638
+ - });
639
+ - ```
640
+ */
641
+ ```
642
+
643
+ /\*\*
644
+
645
+ - @ngdoc method
646
+ - @name $provide#constant
647
+ - @description
648
+ -
649
+ - Register a **constant service** with the {@link auto.$injector $injector}, such as a string,
650
+ - a number, an array, an object or a function. Like the {@link auto.$provide#value value}, it is not
651
+ - possible to inject other services into a constant.
652
+ -
653
+ - But unlike {@link auto.$provide#value value}, a constant can be
654
+ - injected into a module configuration function (see {@link angular.Module#config}) and it cannot
655
+ - be overridden by an AngularJS {@link auto.$provide#decorator decorator}.
656
+ -
657
+ - @param {string} name The name of the constant.
658
+ - @param {\*} value The constant value.
659
+ - @returns {Object} registered instance
660
+ -
661
+ - @example
662
+ - Here a some examples of creating constants:
663
+ - ```js
664
+
665
+ ```
666
+ - $provide.constant('SHARD_HEIGHT', 306);
667
+ -
668
+ - $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);
669
+ -
670
+ - $provide.constant('double', function(value) {
671
+ - return value * 2;
672
+ - });
673
+ - ```
674
+ */
675
+ ```
676
+
677
+ /\*\*
678
+
679
+ - @ngdoc method
680
+ - @name $provide#decorator
681
+ - @description
682
+ -
683
+ - Register a **decorator function** with the {@link auto.$injector $injector}. A decorator function
684
+ - intercepts the creation of a service, allowing it to override or modify the behavior of the
685
+ - service. The return value of the decorator function may be the original service, or a new service
686
+ - that replaces (or wraps and delegates to) the original service.
687
+ -
688
+ - You can find out more about using decorators in the {@link guide/decorators} guide.
689
+ -
690
+ - @param {string} name The name of the service to decorate.
691
+ - @param {Function|Array.<string|Function>} decorator This function will be invoked when the service needs to be
692
+ - provided and should return the decorated service instance. The function is called using
693
+ - the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.
694
+ - Local injection arguments:
695
+ -
696
+ - - `$delegate` - The original service instance, which can be replaced, monkey patched, configured,
697
+ - decorated or delegated to.
698
+ -
699
+ - @example
700
+ - Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting
701
+ - calls to {@link ng.$log#error $log.warn()}.
702
+ - ```js
703
+
704
+ ```
705
+ - $provide.decorator('$log', ['$delegate', function($delegate) {
706
+ - $delegate.warn = $delegate.error;
707
+ - return $delegate;
708
+ - }]);
709
+ - ```
710
+ */
711
+ ```
package/src/jqLite.js CHANGED
@@ -310,7 +310,7 @@ function removeIfEmptyData(element) {
310
310
  (!events || !Object.keys(events).length)
311
311
  ) {
312
312
  CACHE.delete(expandoId);
313
- element[EXPANDO] = undefined; // don't delete DOM expandos. IE and Chrome don't like it
313
+ element[EXPANDO] = undefined; // don't delete DOM expandos. Chrome don't like it
314
314
  }
315
315
  }
316
316