@angular-wave/angular.ts 0.0.62 → 0.0.63

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.
package/src/loader.js CHANGED
@@ -1,28 +1,15 @@
1
1
  import {
2
2
  minErr,
3
- extend,
4
3
  forEach,
5
4
  getNgAttribute,
6
5
  isFunction,
7
6
  isObject,
8
7
  ngAttrPrefixes,
9
8
  isDefined,
10
- isDate,
11
- isElement,
12
- isNumber,
13
- isString,
14
- isUndefined,
15
- merge,
16
- bind,
17
- fromJson,
18
- toJson,
19
- equals,
20
9
  assertNotHasOwnProperty,
21
- isBoolean,
22
- isValidObjectMaxDepth,
23
- minErrConfig,
10
+ errorHandlingConfig,
24
11
  } from "./shared/utils";
25
- import { JQLite, startingTag } from "./shared/jqlite/jqlite";
12
+ import { JQLite } from "./shared/jqlite/jqlite";
26
13
  import { createInjector } from "./injector";
27
14
  import { CACHE } from "./core/cache/cache";
28
15
 
@@ -33,14 +20,10 @@ export const VERSION = "[VI]{version}[/VI]";
33
20
 
34
21
  const ngMinErr = minErr("ng");
35
22
 
36
- /** @type {Object.<string, import('./types').Module>} */
37
- const moduleCache = {};
38
-
39
23
  /**
40
24
  * Configuration option for AngularTS bootstrap process.
41
25
  *
42
26
  * @typedef {Object} AngularBootstrapConfig
43
- * @property {boolean} debugInfoEnabled - Indicates whether debug information should be enabled. Setting this to `false` can improve performance but will disable some debugging features.
44
27
  * @property {boolean} [strictDi] - Disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. Defaults to `false`.
45
28
  */
46
29
 
@@ -60,110 +43,104 @@ export class Angular {
60
43
  /** @type {typeof import('./shared/jqlite/jqlite').JQLite} */
61
44
  this.element = JQLite;
62
45
 
63
- /** @type {errorHandlingConfig} */
64
- this.errorHandlingConfig = errorHandlingConfig;
46
+ /** @type {!Array<string|any>} */
47
+ this.bootsrappedModules = [];
65
48
 
66
49
  /** @type {Function} */
67
50
  this.doBootstrap;
68
51
  }
69
52
 
70
53
  /**
71
- * @module angular
72
- * @function bootstrap
54
+ * Configure several aspects of error handling if used as a setter or return the
55
+ * current configuration if used as a getter.
56
+ *
57
+ * Omitted or undefined options will leave the corresponding configuration values unchanged.
58
+ *
59
+ * @param {import('./shared/utils').ErrorHandlingConfig} [config]
60
+ * @returns {import('./shared/utils').ErrorHandlingConfig}
61
+ */
62
+ errorHandlingConfig(config) {
63
+ return errorHandlingConfig(config);
64
+ }
73
65
 
74
- * @description
75
- * Use this function to manually start up AngularJS application.
76
- *
77
- * For more information, see the {@link guide/bootstrap Bootstrap guide}.
78
- *
79
- * AngularJS will detect if it has been loaded into the browser more than once and only allow the
80
- * first loaded script to be bootstrapped and will report a warning to the browser console for
81
- * each of the subsequent scripts. This prevents strange results in applications, where otherwise
82
- * multiple instances of AngularJS try to work on the DOM.
83
- *
84
- * <div class="alert alert-warning">
85
- * **Note:** Protractor based end-to-end tests cannot use this function to bootstrap manually.
86
- * They must use {@link ng.directive:ngApp ngApp}.
87
- * </div>
88
- *
89
- * <div class="alert alert-warning">
90
- * **Note:** Do not bootstrap the app on an element with a directive that uses {@link ng.$compile#transclusion transclusion},
91
- * such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and {@link ngRoute.ngView `ngView`}.
92
- * Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},
93
- * causing animations to stop working and making the injector inaccessible from outside the app.
94
- * </div>
95
- *
96
- * ```html
97
- * <!doctype html>
98
- * <html>
99
- * <body>
100
- * <div ng-controller="WelcomeController">
101
- * {{greeting}}
102
- * </div>
103
- *
104
- * <script src="angular.js"></script>
105
- * <script>
106
- * let app = angular.module('demo', [])
107
- * .controller('WelcomeController', function($scope) {
108
- * $scope.greeting = 'Welcome!';
109
- * });
110
- * angular.bootstrap(document, ['demo']);
111
- * </script>
112
- * </body>
113
- * </html>
114
- * ```
115
- *
116
- * @param {string | Element | Document} element DOM element which is the root of AngularJS application.
117
- * @param {Array<string | Function | any[]>=} modules an array of modules to load into the application.
118
- * Each item in the array should be the name of a predefined module or a (DI annotated)
119
- * function that will be invoked by the injector as a `config` block.
120
- * See: {@link angular.module modules}
121
- * @param {AngularBootstrapConfig} [config] an object for defining configuration options for the application. The
122
- * following keys are supported:
123
- *
124
- * * `strictDi` - disable automatic function annotation for the application. This is meant to
125
- * assist in finding bugs which break minified code. Defaults to `false`.
126
- *
127
- * @returns {any} InjectorService - Returns the newly created injector for this app.
128
- */
66
+ /**
67
+ * Use this function to manually start up AngularJS application.
68
+ *
69
+ * For more information, see the {@link guide/bootstrap Bootstrap guide}.
70
+ *
71
+ * AngularJS will detect if it has been loaded into the browser more than once and only allow the
72
+ * first loaded script to be bootstrapped and will report a warning to the browser console for
73
+ * each of the subsequent scripts. This prevents strange results in applications, where otherwise
74
+ * multiple instances of AngularJS try to work on the DOM.
75
+ *
76
+ * <div class="alert alert-warning">
77
+ * **Note:** Protractor based end-to-end tests cannot use this function to bootstrap manually.
78
+ * They must use {@link ng.directive:ngApp ngApp}.
79
+ * </div>
80
+ *
81
+ * <div class="alert alert-warning">
82
+ * **Note:** Do not bootstrap the app on an element with a directive that uses {@link ng.$compile#transclusion transclusion},
83
+ * such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and {@link ngRoute.ngView `ngView`}.
84
+ * Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},
85
+ * causing animations to stop working and making the injector inaccessible from outside the app.
86
+ * </div>
87
+ *
88
+ * ```html
89
+ * <!doctype html>
90
+ * <html>
91
+ * <body>
92
+ * <div ng-controller="WelcomeController">
93
+ * {{greeting}}
94
+ * </div>
95
+ *
96
+ * <script src="angular.js"></script>
97
+ * <script>
98
+ * let app = angular.module('demo', [])
99
+ * .controller('WelcomeController', function($scope) {
100
+ * $scope.greeting = 'Welcome!';
101
+ * });
102
+ * angular.bootstrap(document, ['demo']);
103
+ * </script>
104
+ * </body>
105
+ * </html>
106
+ * ```
107
+ *
108
+ * @param {string | Element | Document} element DOM element which is the root of AngularJS application.
109
+ * @param {Array<String|any>} [modules] an array of modules to load into the application.
110
+ * Each item in the array should be the name of a predefined module or a (DI annotated)
111
+ * function that will be invoked by the injector as a `config` block.
112
+ * See: {@link angular.module modules}
113
+ * @param {AngularBootstrapConfig} [config] an object for defining configuration options for the application. The
114
+ * following keys are supported:
115
+ *
116
+ * * `strictDi` - disable automatic function annotation for the application. This is meant to
117
+ * assist in finding bugs which break minified code. Defaults to `false`.
118
+ *
119
+ * @returns {any} InjectorService - Returns the newly created injector for this app.
120
+ */
129
121
  bootstrap(element, modules, config) {
130
122
  config = config || {
131
- debugInfoEnabled: false,
132
123
  strictDi: false,
133
124
  };
134
125
 
135
126
  this.doBootstrap = function () {
136
- element = JQLite(element);
137
-
138
- if (element.injector()) {
139
- const tag =
140
- element[0] === window.document ? "document" : startingTag(element);
141
- // Encode angle brackets to prevent input from being sanitized to empty string #8683.
142
- throw ngMinErr(
143
- "btstrpd",
144
- "App already bootstrapped with this element '{0}'",
145
- tag.replace(/</, "&lt;").replace(/>/, "&gt;"),
146
- );
127
+ var jqLite = JQLite(element);
128
+
129
+ if (jqLite.injector()) {
130
+ throw ngMinErr("btstrpd", "App already bootstrapped");
131
+ }
132
+
133
+ if (Array.isArray(modules)) {
134
+ this.bootsrappedModules = modules;
147
135
  }
148
136
 
149
- this.bootsrappedModules = modules || [];
150
137
  this.bootsrappedModules.unshift([
151
138
  "$provide",
152
139
  ($provide) => {
153
- $provide.value("$rootElement", element);
140
+ $provide.value("$rootElement", jqLite);
154
141
  },
155
142
  ]);
156
143
 
157
- if (config.debugInfoEnabled) {
158
- // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`.
159
- this.bootsrappedModules.push([
160
- "$compileProvider",
161
- function ($compileProvider) {
162
- $compileProvider.debugInfoEnabled(true);
163
- },
164
- ]);
165
- }
166
-
167
144
  this.bootsrappedModules.unshift("ng");
168
145
 
169
146
  const injector = createInjector(this.bootsrappedModules, config.strictDi);
@@ -172,7 +149,14 @@ export class Angular {
172
149
  "$rootElement",
173
150
  "$compile",
174
151
  "$injector",
175
- function bootstrapApply(scope, el, compile, $injector) {
152
+ /**
153
+ *
154
+ * @param {*} scope
155
+ * @param {JQLite} el
156
+ * @param {*} compile
157
+ * @param {*} $injector
158
+ */
159
+ function (scope, el, compile, $injector) {
176
160
  scope.$apply(() => {
177
161
  el.data("$injector", $injector);
178
162
  compile(el)(scope);
@@ -182,36 +166,26 @@ export class Angular {
182
166
  return injector;
183
167
  };
184
168
 
185
- const NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;
186
169
  const NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
187
170
 
188
- if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {
189
- config.debugInfoEnabled = true;
190
- window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, "");
191
- }
192
-
193
171
  if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
194
172
  return this.doBootstrap();
195
173
  }
196
174
 
197
175
  window.name = window.name.replace(NG_DEFER_BOOTSTRAP, "");
198
176
  this.resumeBootstrap = function (extraModules) {
199
- forEach(extraModules, function (module) {
200
- modules.push(module);
201
- });
177
+ if (Array.isArray(extraModules)) {
178
+ extraModules.forEach((module) => modules.push(module));
179
+ }
202
180
  return this.doBootstrap();
203
181
  };
204
-
205
- if (isFunction(this.resumeDeferredBootstrap)) {
206
- this.resumeDeferredBootstrap();
207
- }
208
182
  }
209
183
 
210
184
  /**
211
185
  *
212
186
  * @param {any[]} modules
213
187
  * @param {boolean?} strictDi
214
- * @returns {angular.auto.IInjectorService}
188
+ * @returns {import("./types").InjectorService}
215
189
  */
216
190
  injector(modules, strictDi) {
217
191
  return createInjector(modules, strictDi);
@@ -224,400 +198,6 @@ export class Angular {
224
198
  return this.doBootstrap();
225
199
  }
226
200
 
227
- /**
228
- *
229
- * The `angular.module` is a global place for creating, registering and retrieving AngularJS
230
- * modules.
231
- * All modules (AngularJS core or 3rd party) that should be available to an application must be
232
- * registered using this mechanism.
233
- *
234
- * Passing one argument retrieves an existing {@link import('./types').Module},
235
- * whereas passing more than one argument creates a new {@link import('./types').Module}
236
- *
237
- *
238
- * # Module
239
- *
240
- * A module is a collection of services, directives, controllers, filters, and configuration information.
241
- * `angular.module` is used to configure the {@link auto.$injector $injector}.
242
- *
243
- * ```js
244
- * // Create a new module
245
- * let myModule = angular.module('myModule', []);
246
- *
247
- * // register a new service
248
- * myModule.value('appName', 'MyCoolApp');
249
- *
250
- * // configure existing services inside initialization blocks.
251
- * myModule.config(['$locationProvider', function($locationProvider) {
252
- * // Configure existing providers
253
- * $locationProvider.hashPrefix('!');
254
- * }]);
255
- * ```
256
- *
257
- * Then you can create an injector and load your modules like this:
258
- *
259
- * ```js
260
- * let injector = angular.injector(['ng', 'myModule'])
261
- * ```
262
- *
263
- * However it's more likely that you'll just use
264
- * {@link ng.directive:ngApp ngApp} or
265
- * {@link angular.bootstrap} to simplify this process for you.
266
- *
267
- * @param {!string} name The name of the module to create or retrieve.
268
- * @param {!Array.<string>=} requires If specified then new module is being created. If
269
- * unspecified then the module is being retrieved for further configuration.
270
- * @param {Function=} configFn Optional configuration function for the module. Same as
271
- * {@link import('./types').Module#config Module#config()}.
272
- * @returns {import('./types').Module} new module with the {@link import('./types').Module} api.
273
- */
274
- module(name, requires, configFn) {
275
- const $injectorMinErr = minErr("$injector");
276
- let info = {};
277
-
278
- assertNotHasOwnProperty(name, "module");
279
- if (requires && Object.prototype.hasOwnProperty.call(moduleCache, name)) {
280
- moduleCache[name] = null;
281
- }
282
-
283
- function ensure(obj, name, factory) {
284
- return obj[name] || (obj[name] = factory());
285
- }
286
-
287
- return ensure(moduleCache, name, () => {
288
- if (!requires) {
289
- throw $injectorMinErr(
290
- "nomod",
291
- "Module '{0}' is not available! You either misspelled " +
292
- "the module name or forgot to load it. If registering a module ensure that you " +
293
- "specify the dependencies as the second argument.",
294
- name,
295
- );
296
- }
297
-
298
- /** @type {!Array.<Array.<*>>} */
299
- const invokeQueue = [];
300
-
301
- /** @type {!Array.<Function>} */
302
- const configBlocks = [];
303
-
304
- /** @type {!Array.<Function>} */
305
- const runBlocks = [];
306
-
307
- const config = invokeLater("$injector", "invoke", "push", configBlocks);
308
-
309
- /** @type {import('./types').Module} */
310
- const moduleInstance = {
311
- // Private state
312
-
313
- _invokeQueue: invokeQueue,
314
- _configBlocks: configBlocks,
315
- _runBlocks: runBlocks,
316
-
317
- /**
318
- * @ngdoc method
319
- * @name import('./types').Module#info
320
- * @module ng
321
- *
322
- * @param {Object=} value Information about the module
323
- * @returns {Object|import('./types').Module} The current info object for this module if called as a getter,
324
- * or `this` if called as a setter.
325
- *
326
- * @description
327
- * Read and write custom information about this module.
328
- * For example you could put the version of the module in here.
329
- *
330
- * ```js
331
- * angular.module('myModule', []).info({ version: '1.0.0' });
332
- * ```
333
- *
334
- * The version could then be read back out by accessing the module elsewhere:
335
- *
336
- * ```
337
- * let version = angular.module('myModule').info().version;
338
- * ```
339
- *
340
- * You can also retrieve this information during runtime via the
341
- * {@link $injector#modules `$injector.modules`} property:
342
- *
343
- * ```js
344
- * let version = $injector.modules['myModule'].info().version;
345
- * ```
346
- */
347
- info(value) {
348
- if (isDefined(value)) {
349
- if (!isObject(value))
350
- throw ngMinErr(
351
- "aobj",
352
- "Argument '{0}' must be an object",
353
- "value",
354
- );
355
- info = value;
356
- return this;
357
- }
358
- return info;
359
- },
360
-
361
- /**
362
- * @ngdoc property
363
- * @type import('./types').Module#requires
364
- * @module ng
365
- *
366
- * @description
367
- * Holds the list of modules which the injector will load before the current module is
368
- * loaded.
369
- */
370
- requires,
371
-
372
- /**
373
- * @ngdoc property
374
- * @name import('./types').Module#name
375
- * @module ng
376
- *
377
- * @description
378
- * Name of the module.
379
- */
380
- name,
381
-
382
- /**
383
- * @ngdoc method
384
- * @name import('./types').Module#provider
385
- * @module ng
386
- * @param {string} name service name
387
- * @param {Function} providerType Construction function for creating new instance of the
388
- * service.
389
- * @description
390
- * See {@link auto.$provide#provider $provide.provider()}.
391
- */
392
- provider: invokeLaterAndSetModuleName("$provide", "provider"),
393
-
394
- /**
395
- * @ngdoc method
396
- * @name import('./types').Module#factory
397
- * @module ng
398
- * @param {string} name service name
399
- * @param {Function} providerFunction Function for creating new instance of the service.
400
- * @description
401
- * See {@link auto.$provide#factory $provide.factory()}.
402
- */
403
- factory: invokeLaterAndSetModuleName("$provide", "factory"),
404
-
405
- /**
406
- * @ngdoc method
407
- * @name import('./types').Module#service
408
- * @module ng
409
- * @param {string} name service name
410
- * @param {Function} constructor A constructor function that will be instantiated.
411
- * @description
412
- * See {@link auto.$provide#service $provide.service()}.
413
- */
414
- service: invokeLaterAndSetModuleName("$provide", "service"),
415
-
416
- /**
417
- * @ngdoc method
418
- * @name import('./types').Module#value
419
- * @module ng
420
- * @param {string} name service name
421
- * @param {*} object Service instance object.
422
- * @description
423
- * See {@link auto.$provide#value $provide.value()}.
424
- */
425
- value: invokeLater("$provide", "value"),
426
-
427
- /**
428
- * @ngdoc method
429
- * @name import('./types').Module#constant
430
- * @module ng
431
- * @param {string} name constant name
432
- * @param {*} object Constant value.
433
- * @description
434
- * Because the constants are fixed, they get applied before other provide methods.
435
- * See {@link auto.$provide#constant $provide.constant()}.
436
- */
437
- constant: invokeLater("$provide", "constant", "unshift"),
438
-
439
- /**
440
- * @ngdoc method
441
- * @name import('./types').Module#decorator
442
- * @module ng
443
- * @param {string} name The name of the service to decorate.
444
- * @param {Function} decorFn This function will be invoked when the service needs to be
445
- * instantiated and should return the decorated service instance.
446
- * @description
447
- * See {@link auto.$provide#decorator $provide.decorator()}.
448
- */
449
- decorator: invokeLaterAndSetModuleName(
450
- "$provide",
451
- "decorator",
452
- configBlocks,
453
- ),
454
-
455
- /**
456
- * @ngdoc method
457
- * @name import('./types').Module#animation
458
- * @module ng
459
- * @param {string} name animation name
460
- * @param {Function} animationFactory Factory function for creating new instance of an
461
- * animation.
462
- * @description
463
- *
464
- * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
465
- *
466
- *
467
- * Defines an animation hook that can be later used with
468
- * {@link $animate $animate} service and directives that use this service.
469
- *
470
- * ```js
471
- * module.animation('.animation-name', function($inject1, $inject2) {
472
- * return {
473
- * eventName : function(element, done) {
474
- * //code to run the animation
475
- * //once complete, then run done()
476
- * return function cancellationFunction(element) {
477
- * //code to cancel the animation
478
- * }
479
- * }
480
- * }
481
- * })
482
- * ```
483
- *
484
- * See {@link ng.$animateProvider#register $animateProvider.register()} and
485
- * {@link ngAnimate ngAnimate module} for more information.
486
- */
487
- animation: invokeLaterAndSetModuleName("$animateProvider", "register"),
488
-
489
- /**
490
- * @ngdoc method
491
- * @name import('./types').Module#filter
492
- * @module ng
493
- * @param {string} name Filter name - this must be a valid AngularJS expression identifier
494
- * @param {Function} filterFactory Factory function for creating new instance of filter.
495
- * @description
496
- * See {@link ng.$filterProvider#register $filterProvider.register()}.
497
- *
498
- * <div class="alert alert-warning">
499
- * **Note:** Filter names must be valid AngularJS {@link expression} identifiers, such as `uppercase` or `orderBy`.
500
- * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
501
- * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
502
- * (`myapp_subsection_filterx`).
503
- * </div>
504
- */
505
- filter: invokeLaterAndSetModuleName("$filterProvider", "register"),
506
-
507
- /**
508
- * @ngdoc method
509
- * @name import('./types').Module#controller
510
- * @module ng
511
- * @param {string|Object} name Controller name, or an object map of controllers where the
512
- * keys are the names and the values are the constructors.
513
- * @param {Function} constructor Controller constructor function.
514
- * @description
515
- * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
516
- */
517
- controller: invokeLaterAndSetModuleName(
518
- "$controllerProvider",
519
- "register",
520
- ),
521
-
522
- /**
523
- * @ngdoc method
524
- * @name import('./types').Module#directive
525
- * @module ng
526
- * @param {string|Object} name Directive name, or an object map of directives where the
527
- * keys are the names and the values are the factories.
528
- * @param {Function} directiveFactory Factory function for creating new instance of
529
- * directives.
530
- * @description
531
- * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
532
- */
533
- directive: invokeLaterAndSetModuleName("$compileProvider", "directive"),
534
-
535
- /**
536
- * @ngdoc method
537
- * @name import('./types').Module#component
538
- * @module ng
539
- * @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`),
540
- * or an object map of components where the keys are the names and the values are the component definition objects.
541
- * @param {Object} options Component definition object (a simplified
542
- * {@link ng.$compile#directive-definition-object directive definition object})
543
- *
544
- * @description
545
- * See {@link ng.$compileProvider#component $compileProvider.component()}.
546
- */
547
- component: invokeLaterAndSetModuleName("$compileProvider", "component"),
548
-
549
- /**
550
- * @ngdoc method
551
- * @name import('./types').Module#config
552
- * @module ng
553
- * @param {Function} configFn Execute this function on module load. Useful for service
554
- * configuration.
555
- * @description
556
- * Use this method to configure services by injecting their
557
- * {@link import('./types').Module#provider `providers`}, e.g. for adding routes to the
558
- * {@link ngRoute.$routeProvider $routeProvider}.
559
- *
560
- * Note that you can only inject {@link import('./types').Module#provider `providers`} and
561
- * {@link import('./types').Module#constant `constants`} into this function.
562
- *
563
- * For more about how to configure services, see
564
- * {@link providers#provider-recipe Provider Recipe}.
565
- */
566
- config,
567
-
568
- /**
569
- * @ngdoc method
570
- * @name import('./types').Module#run
571
- * @module ng
572
- * @param {Function} initializationFn Execute this function after injector creation.
573
- * Useful for application initialization.
574
- * @description
575
- * Use this method to register work which should be performed when the injector is done
576
- * loading all modules.
577
- */
578
- run(block) {
579
- runBlocks.push(block);
580
- return this;
581
- },
582
- };
583
-
584
- if (configFn) {
585
- config(configFn);
586
- }
587
-
588
- return moduleInstance;
589
-
590
- /**
591
- * @param {string} provider
592
- * @param {string} method
593
- * @param {String=} insertMethod
594
- * @returns {import('./types').Module}
595
- */
596
- function invokeLater(provider, method, insertMethod, queue) {
597
- if (!queue) queue = invokeQueue;
598
- return function () {
599
- queue[insertMethod || "push"]([provider, method, arguments]);
600
- return moduleInstance;
601
- };
602
- }
603
-
604
- /**
605
- * @param {string} provider
606
- * @param {string} method
607
- * @returns {import('./types').Module}
608
- */
609
- function invokeLaterAndSetModuleName(provider, method, queue) {
610
- if (!queue) queue = invokeQueue;
611
- return function (recipeName, factoryFunction) {
612
- if (factoryFunction && isFunction(factoryFunction))
613
- factoryFunction.$$moduleName = name;
614
- queue.push([provider, method, arguments]);
615
- return moduleInstance;
616
- };
617
- }
618
- });
619
- }
620
-
621
201
  /**
622
202
  * @module angular
623
203
  * @function reloadWithDebugInfo
@@ -777,6 +357,10 @@ export class Angular {
777
357
  </file>
778
358
  </example>
779
359
  */
360
+
361
+ /**
362
+ * @param {Element|Document} element
363
+ */
780
364
  export function angularInit(element) {
781
365
  let appElement;
782
366
  let module;
@@ -804,15 +388,7 @@ export function angularInit(element) {
804
388
  }
805
389
  });
806
390
  if (appElement) {
807
- // Angular init is called manually, so why is this check here
808
- // if (!confGlobal.isAutoBootstrapAllowed) {
809
- // window.console.error(
810
- // "AngularJS: disabling automatic bootstrap. <script> protocol indicates an extension, document.location.href does not match.",
811
- // );
812
- // return;
813
- // }
814
391
  config.strictDi = getNgAttribute(appElement, "strict-di") !== null;
815
- //TODO maybe angular should be initialized here?
816
392
  window["angular"].bootstrap(appElement, module ? [module] : [], config);
817
393
  }
818
394
  }
@@ -841,57 +417,6 @@ export function setupModuleLoader(window) {
841
417
  /** @type {Object.<string, import('./types').Module>} */
842
418
  const modules = {};
843
419
 
844
- /**
845
- * @ngdoc function
846
- * @name angular.module
847
- * @module ng
848
- * @description
849
- *
850
- * The `angular.module` is a global place for creating, registering and retrieving AngularJS
851
- * modules.
852
- * All modules (AngularJS core or 3rd party) that should be available to an application must be
853
- * registered using this mechanism.
854
- *
855
- * Passing one argument retrieves an existing {@link import('./types').Module},
856
- * whereas passing more than one argument creates a new {@link import('./types').Module}
857
- *
858
- *
859
- * # Module
860
- *
861
- * A module is a collection of services, directives, controllers, filters, and configuration information.
862
- * `angular.module` is used to configure the {@link auto.$injector $injector}.
863
- *
864
- * ```js
865
- * // Create a new module
866
- * let myModule = angular.module('myModule', []);
867
- *
868
- * // register a new service
869
- * myModule.value('appName', 'MyCoolApp');
870
- *
871
- * // configure existing services inside initialization blocks.
872
- * myModule.config(['$locationProvider', function($locationProvider) {
873
- * // Configure existing providers
874
- * $locationProvider.hashPrefix('!');
875
- * }]);
876
- * ```
877
- *
878
- * Then you can create an injector and load your modules like this:
879
- *
880
- * ```js
881
- * let injector = angular.injector(['ng', 'myModule'])
882
- * ```
883
- *
884
- * However it's more likely that you'll just use
885
- * {@link ng.directive:ngApp ngApp} or
886
- * {@link angular.bootstrap} to simplify this process for you.
887
- *
888
- * @param {!string} name The name of the module to create or retrieve.
889
- * @param {!Array.<string>=} requires If specified then new module is being created. If
890
- * unspecified then the module is being retrieved for further configuration.
891
- * @param {Function=} configFn Optional configuration function for the module. Same as
892
- * {@link import('./types').Module#config Module#config()}.
893
- * @returns {import('./types').Module} new module with the {@link import('./types').Module} api.
894
- */
895
420
  return function module(name, requires, configFn) {
896
421
  let info = {};
897
422
 
@@ -929,15 +454,13 @@ export function setupModuleLoader(window) {
929
454
  _runBlocks: runBlocks,
930
455
 
931
456
  /**
932
- * @ngdoc method
933
457
  * @name import('./types').Module#info
934
458
  * @module ng
935
459
  *
936
- * @param {Object=} info Information about the module
460
+ * @param {Object=} value Information about the module
937
461
  * @returns {Object|import('./types').Module} The current info object for this module if called as a getter,
938
462
  * or `this` if called as a setter.
939
463
  *
940
- * @description
941
464
  * Read and write custom information about this module.
942
465
  * For example you could put the version of the module in here.
943
466
  *
@@ -977,7 +500,6 @@ export function setupModuleLoader(window) {
977
500
  * @name import('./types').Module#requires
978
501
  * @module ng
979
502
  *
980
- * @description
981
503
  * Holds the list of modules which the injector will load before the current module is
982
504
  * loaded.
983
505
  */
@@ -988,76 +510,57 @@ export function setupModuleLoader(window) {
988
510
  * @name import('./types').Module#name
989
511
  * @module ng
990
512
  *
991
- * @description
992
513
  * Name of the module.
993
514
  */
994
515
  name,
995
516
 
996
517
  /**
997
- * @ngdoc method
998
518
  * @name import('./types').Module#provider
999
- * @module ng
1000
519
  * @param {string} name service name
1001
520
  * @param {Function} providerType Construction function for creating new instance of the
1002
521
  * service.
1003
- * @description
1004
522
  * See {@link auto.$provide#provider $provide.provider()}.
1005
523
  */
1006
524
  provider: invokeLaterAndSetModuleName("$provide", "provider"),
1007
525
 
1008
526
  /**
1009
- * @ngdoc method
1010
527
  * @name import('./types').Module#factory
1011
- * @module ng
1012
528
  * @param {string} name service name
1013
529
  * @param {Function} providerFunction Function for creating new instance of the service.
1014
- * @description
1015
530
  * See {@link auto.$provide#factory $provide.factory()}.
1016
531
  */
1017
532
  factory: invokeLaterAndSetModuleName("$provide", "factory"),
1018
533
 
1019
534
  /**
1020
- * @ngdoc method
1021
535
  * @name import('./types').Module#service
1022
- * @module ng
1023
536
  * @param {string} name service name
1024
537
  * @param {Function} constructor A constructor function that will be instantiated.
1025
- * @description
1026
538
  * See {@link auto.$provide#service $provide.service()}.
1027
539
  */
1028
540
  service: invokeLaterAndSetModuleName("$provide", "service"),
1029
541
 
1030
542
  /**
1031
- * @ngdoc method
1032
543
  * @name import('./types').Module#value
1033
- * @module ng
1034
544
  * @param {string} name service name
1035
545
  * @param {*} object Service instance object.
1036
- * @description
1037
546
  * See {@link auto.$provide#value $provide.value()}.
1038
547
  */
1039
548
  value: invokeLater("$provide", "value"),
1040
549
 
1041
550
  /**
1042
- * @ngdoc method
1043
551
  * @name import('./types').Module#constant
1044
- * @module ng
1045
552
  * @param {string} name constant name
1046
553
  * @param {*} object Constant value.
1047
- * @description
1048
554
  * Because the constants are fixed, they get applied before other provide methods.
1049
555
  * See {@link auto.$provide#constant $provide.constant()}.
1050
556
  */
1051
557
  constant: invokeLater("$provide", "constant", "unshift"),
1052
558
 
1053
559
  /**
1054
- * @ngdoc method
1055
560
  * @name import('./types').Module#decorator
1056
- * @module ng
1057
561
  * @param {string} name The name of the service to decorate.
1058
562
  * @param {Function} decorFn This function will be invoked when the service needs to be
1059
563
  * instantiated and should return the decorated service instance.
1060
- * @description
1061
564
  * See {@link auto.$provide#decorator $provide.decorator()}.
1062
565
  */
1063
566
  decorator: invokeLaterAndSetModuleName(
@@ -1067,13 +570,10 @@ export function setupModuleLoader(window) {
1067
570
  ),
1068
571
 
1069
572
  /**
1070
- * @ngdoc method
1071
573
  * @name import('./types').Module#animation
1072
- * @module ng
1073
574
  * @param {string} name animation name
1074
575
  * @param {Function} animationFactory Factory function for creating new instance of an
1075
576
  * animation.
1076
- * @description
1077
577
  *
1078
578
  * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
1079
579
  *
@@ -1104,12 +604,9 @@ export function setupModuleLoader(window) {
1104
604
  ),
1105
605
 
1106
606
  /**
1107
- * @ngdoc method
1108
607
  * @name import('./types').Module#filter
1109
- * @module ng
1110
608
  * @param {string} name Filter name - this must be a valid AngularJS expression identifier
1111
609
  * @param {Function} filterFactory Factory function for creating new instance of filter.
1112
- * @description
1113
610
  * See {@link ng.$filterProvider#register $filterProvider.register()}.
1114
611
  *
1115
612
  * <div class="alert alert-warning">
@@ -1122,13 +619,10 @@ export function setupModuleLoader(window) {
1122
619
  filter: invokeLaterAndSetModuleName("$filterProvider", "register"),
1123
620
 
1124
621
  /**
1125
- * @ngdoc method
1126
622
  * @name import('./types').Module#controller
1127
- * @module ng
1128
623
  * @param {string|Object} name Controller name, or an object map of controllers where the
1129
624
  * keys are the names and the values are the constructors.
1130
625
  * @param {Function} constructor Controller constructor function.
1131
- * @description
1132
626
  * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
1133
627
  */
1134
628
  controller: invokeLaterAndSetModuleName(
@@ -1137,14 +631,11 @@ export function setupModuleLoader(window) {
1137
631
  ),
1138
632
 
1139
633
  /**
1140
- * @ngdoc method
1141
634
  * @name import('./types').Module#directive
1142
- * @module ng
1143
635
  * @param {string|Object} name Directive name, or an object map of directives where the
1144
636
  * keys are the names and the values are the factories.
1145
637
  * @param {Function} directiveFactory Factory function for creating new instance of
1146
638
  * directives.
1147
- * @description
1148
639
  * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
1149
640
  */
1150
641
  directive: invokeLaterAndSetModuleName(
@@ -1153,15 +644,12 @@ export function setupModuleLoader(window) {
1153
644
  ),
1154
645
 
1155
646
  /**
1156
- * @ngdoc method
1157
647
  * @name import('./types').Module#component
1158
- * @module ng
1159
648
  * @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`),
1160
649
  * or an object map of components where the keys are the names and the values are the component definition objects.
1161
650
  * @param {Object} options Component definition object (a simplified
1162
651
  * {@link ng.$compile#directive-definition-object directive definition object})
1163
652
  *
1164
- * @description
1165
653
  * See {@link ng.$compileProvider#component $compileProvider.component()}.
1166
654
  */
1167
655
  component: invokeLaterAndSetModuleName(
@@ -1170,12 +658,9 @@ export function setupModuleLoader(window) {
1170
658
  ),
1171
659
 
1172
660
  /**
1173
- * @ngdoc method
1174
661
  * @name import('./types').Module#config
1175
- * @module ng
1176
662
  * @param {Function} configFn Execute this function on module load. Useful for service
1177
663
  * configuration.
1178
- * @description
1179
664
  * Use this method to configure services by injecting their
1180
665
  * {@link import('./types').Module#provider `providers`}, e.g. for adding routes to the
1181
666
  * {@link ngRoute.$routeProvider $routeProvider}.
@@ -1189,12 +674,9 @@ export function setupModuleLoader(window) {
1189
674
  config,
1190
675
 
1191
676
  /**
1192
- * @ngdoc method
1193
677
  * @name import('./types').Module#run
1194
- * @module ng
1195
- * @param {Function} initializationFn Execute this function after injector creation.
678
+ * @param {Function} block Execute this function after injector creation.
1196
679
  * Useful for application initialization.
1197
- * @description
1198
680
  * Use this method to register work which should be performed when the injector is done
1199
681
  * loading all modules.
1200
682
  */
@@ -1213,7 +695,8 @@ export function setupModuleLoader(window) {
1213
695
  /**
1214
696
  * @param {string} provider
1215
697
  * @param {string} method
1216
- * @param {String=} insertMethod
698
+ * @param {String=} [insertMethod]
699
+ * @param {Array<any>} [queue]
1217
700
  * @returns {import('./types').Module}
1218
701
  */
1219
702
  function invokeLater(provider, method, insertMethod, queue) {
@@ -1242,47 +725,3 @@ export function setupModuleLoader(window) {
1242
725
  };
1243
726
  });
1244
727
  }
1245
-
1246
- /**
1247
- * @ngdoc function
1248
- * @name angular.errorHandlingConfig
1249
- * @module ng
1250
- * @kind function
1251
- *
1252
- * @description
1253
- * Configure several aspects of error handling in AngularJS if used as a setter or return the
1254
- * current configuration if used as a getter. The following options are supported:
1255
- *
1256
- * - **objectMaxDepth**: The maximum depth to which objects are traversed when stringified for error messages.
1257
- *
1258
- * Omitted or undefined options will leave the corresponding configuration values unchanged.
1259
- *
1260
- * @param {Object=} config - The configuration object. May only contain the options that need to be
1261
- * updated. Supported keys:
1262
- *
1263
- * * `objectMaxDepth` **{Number}** - The max depth for stringifying objects. Setting to a
1264
- * non-positive or non-numeric value, removes the max depth limit.
1265
- * Default: 5
1266
- *
1267
- * * `urlErrorParamsEnabled` **{Boolean}** - Specifies whether the generated error url will
1268
- * contain the parameters of the thrown error. Disabling the parameters can be useful if the
1269
- * generated error url is very long.
1270
- *
1271
- * Default: true. When used without argument, it returns the current value.
1272
- */
1273
- export function errorHandlingConfig(config) {
1274
- if (isObject(config)) {
1275
- if (isDefined(config.objectMaxDepth)) {
1276
- minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth)
1277
- ? config.objectMaxDepth
1278
- : NaN;
1279
- }
1280
- if (
1281
- isDefined(config.urlErrorParamsEnabled) &&
1282
- isBoolean(config.urlErrorParamsEnabled)
1283
- ) {
1284
- minErrConfig.urlErrorParamsEnabled = config.urlErrorParamsEnabled;
1285
- }
1286
- }
1287
- return minErrConfig;
1288
- }