@angular/upgrade 14.0.0-next.13 → 14.0.0-next.16

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.
@@ -1,657 +1,658 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.13
2
+ * @license Angular v14.0.0-next.16
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { DoCheck } from '@angular/core';
8
- import { ElementRef } from '@angular/core';
9
- import * as i0 from '@angular/core';
10
- import { Injector } from '@angular/core';
11
- import { NgModuleFactory } from '@angular/core';
12
- import { NgModuleRef } from '@angular/core';
13
- import { NgZone } from '@angular/core';
14
- import { OnChanges } from '@angular/core';
15
- import { OnDestroy } from '@angular/core';
16
- import { OnInit } from '@angular/core';
17
- import { PlatformRef } from '@angular/core';
18
- import { SimpleChanges } from '@angular/core';
19
- import { StaticProvider } from '@angular/core';
20
- import { Type } from '@angular/core';
21
- import { Version } from '@angular/core';
22
-
23
- /**
24
- * @description
25
- *
26
- * A helper function that allows an Angular component to be used from AngularJS.
27
- *
28
- * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)
29
- * library for hybrid upgrade apps that support AOT compilation*
30
- *
31
- * This helper function returns a factory function to be used for registering
32
- * an AngularJS wrapper directive for "downgrading" an Angular component.
33
- *
34
- * @usageNotes
35
- * ### Examples
36
- *
37
- * Let's assume that you have an Angular component called `ng2Heroes` that needs
38
- * to be made available in AngularJS templates.
39
- *
40
- * {@example upgrade/static/ts/full/module.ts region="ng2-heroes"}
41
- *
42
- * We must create an AngularJS [directive](https://docs.angularjs.org/guide/directive)
43
- * that will make this Angular component available inside AngularJS templates.
44
- * The `downgradeComponent()` function returns a factory function that we
45
- * can use to define the AngularJS directive that wraps the "downgraded" component.
46
- *
47
- * {@example upgrade/static/ts/full/module.ts region="ng2-heroes-wrapper"}
48
- *
49
- * For more details and examples on downgrading Angular components to AngularJS components please
50
- * visit the [Upgrade guide](guide/upgrade#using-angular-components-from-angularjs-code).
51
- *
52
- * @param info contains information about the Component that is being downgraded:
53
- *
54
- * - `component: Type<any>`: The type of the Component that will be downgraded
55
- * - `downgradedModule?: string`: The name of the downgraded module (if any) that the component
56
- * "belongs to", as returned by a call to `downgradeModule()`. It is the module, whose
57
- * corresponding Angular module will be bootstrapped, when the component needs to be instantiated.
58
- * <br />
59
- * (This option is only necessary when using `downgradeModule()` to downgrade more than one
60
- * Angular module.)
61
- * - `propagateDigest?: boolean`: Whether to perform {@link ChangeDetectorRef#detectChanges
62
- * change detection} on the component on every
63
- * [$digest](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest). If set to `false`,
64
- * change detection will still be performed when any of the component's inputs changes.
65
- * (Default: true)
66
- *
67
- * @returns a factory function that can be used to register the component in an
68
- * AngularJS module.
69
- *
70
- * @publicApi
71
- */
72
- export declare function downgradeComponent(info: {
73
- component: Type<any>;
74
- downgradedModule?: string;
75
- propagateDigest?: boolean;
76
- /** @deprecated since v4. This parameter is no longer used */
77
- inputs?: string[];
78
- /** @deprecated since v4. This parameter is no longer used */
79
- outputs?: string[];
80
- /** @deprecated since v4. This parameter is no longer used */
81
- selectors?: string[];
82
- }): any;
83
-
84
-
85
- /**
86
- * @description
87
- *
88
- * A helper function to allow an Angular service to be accessible from AngularJS.
89
- *
90
- * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)
91
- * library for hybrid upgrade apps that support AOT compilation*
92
- *
93
- * This helper function returns a factory function that provides access to the Angular
94
- * service identified by the `token` parameter.
95
- *
96
- * @usageNotes
97
- * ### Examples
98
- *
99
- * First ensure that the service to be downgraded is provided in an `NgModule`
100
- * that will be part of the upgrade application. For example, let's assume we have
101
- * defined `HeroesService`
102
- *
103
- * {@example upgrade/static/ts/full/module.ts region="ng2-heroes-service"}
104
- *
105
- * and that we have included this in our upgrade app `NgModule`
106
- *
107
- * {@example upgrade/static/ts/full/module.ts region="ng2-module"}
108
- *
109
- * Now we can register the `downgradeInjectable` factory function for the service
110
- * on an AngularJS module.
111
- *
112
- * {@example upgrade/static/ts/full/module.ts region="downgrade-ng2-heroes-service"}
113
- *
114
- * Inside an AngularJS component's controller we can get hold of the
115
- * downgraded service via the name we gave when downgrading.
116
- *
117
- * {@example upgrade/static/ts/full/module.ts region="example-app"}
118
- *
119
- * <div class="alert is-important">
120
- *
121
- * When using `downgradeModule()`, downgraded injectables will not be available until the Angular
122
- * module that provides them is instantiated. In order to be safe, you need to ensure that the
123
- * downgraded injectables are not used anywhere _outside_ the part of the app where it is
124
- * guaranteed that their module has been instantiated.
125
- *
126
- * For example, it is _OK_ to use a downgraded service in an upgraded component that is only used
127
- * from a downgraded Angular component provided by the same Angular module as the injectable, but
128
- * it is _not OK_ to use it in an AngularJS component that may be used independently of Angular or
129
- * use it in a downgraded Angular component from a different module.
130
- *
131
- * </div>
132
- *
133
- * @param token an `InjectionToken` that identifies a service provided from Angular.
134
- * @param downgradedModule the name of the downgraded module (if any) that the injectable
135
- * "belongs to", as returned by a call to `downgradeModule()`. It is the module, whose injector will
136
- * be used for instantiating the injectable.<br />
137
- * (This option is only necessary when using `downgradeModule()` to downgrade more than one Angular
138
- * module.)
139
- *
140
- * @returns a [factory function](https://docs.angularjs.org/guide/di) that can be
141
- * used to register the service on an AngularJS module.
142
- *
143
- * @publicApi
144
- */
145
- export declare function downgradeInjectable(token: any, downgradedModule?: string): Function;
146
-
147
- /**
148
- * @description
149
- *
150
- * A helper function for creating an AngularJS module that can bootstrap an Angular module
151
- * "on-demand" (possibly lazily) when a {@link downgradeComponent downgraded component} needs to be
152
- * instantiated.
153
- *
154
- * *Part of the [upgrade/static](api?query=upgrade/static) library for hybrid upgrade apps that
155
- * support AOT compilation.*
156
- *
157
- * It allows loading/bootstrapping the Angular part of a hybrid application lazily and not having to
158
- * pay the cost up-front. For example, you can have an AngularJS application that uses Angular for
159
- * specific routes and only instantiate the Angular modules if/when the user visits one of these
160
- * routes.
161
- *
162
- * The Angular module will be bootstrapped once (when requested for the first time) and the same
163
- * reference will be used from that point onwards.
164
- *
165
- * `downgradeModule()` requires either an `NgModuleFactory`, `NgModule` class or a function:
166
- * - `NgModuleFactory`: If you pass an `NgModuleFactory`, it will be used to instantiate a module
167
- * using `platformBrowser`'s {@link PlatformRef#bootstrapModuleFactory bootstrapModuleFactory()}.
168
- * NOTE: this type of the argument is deprecated. Please either provide an `NgModule` class or a
169
- * bootstrap function instead.
170
- * - `NgModule` class: If you pass an NgModule class, it will be used to instantiate a module
171
- * using `platformBrowser`'s {@link PlatformRef#bootstrapModule bootstrapModule()}.
172
- * - `Function`: If you pass a function, it is expected to return a promise resolving to an
173
- * `NgModuleRef`. The function is called with an array of extra {@link StaticProvider Providers}
174
- * that are expected to be available from the returned `NgModuleRef`'s `Injector`.
175
- *
176
- * `downgradeModule()` returns the name of the created AngularJS wrapper module. You can use it to
177
- * declare a dependency in your main AngularJS module.
178
- *
179
- * {@example upgrade/static/ts/lite/module.ts region="basic-how-to"}
180
- *
181
- * For more details on how to use `downgradeModule()` see
182
- * [Upgrading for Performance](guide/upgrade-performance).
183
- *
184
- * @usageNotes
185
- *
186
- * Apart from `UpgradeModule`, you can use the rest of the `upgrade/static` helpers as usual to
187
- * build a hybrid application. Note that the Angular pieces (e.g. downgraded services) will not be
188
- * available until the downgraded module has been bootstrapped, i.e. by instantiating a downgraded
189
- * component.
190
- *
191
- * <div class="alert is-important">
192
- *
193
- * You cannot use `downgradeModule()` and `UpgradeModule` in the same hybrid application.<br />
194
- * Use one or the other.
195
- *
196
- * </div>
197
- *
198
- * ### Differences with `UpgradeModule`
199
- *
200
- * Besides their different API, there are two important internal differences between
201
- * `downgradeModule()` and `UpgradeModule` that affect the behavior of hybrid applications:
202
- *
203
- * 1. Unlike `UpgradeModule`, `downgradeModule()` does not bootstrap the main AngularJS module
204
- * inside the {@link NgZone Angular zone}.
205
- * 2. Unlike `UpgradeModule`, `downgradeModule()` does not automatically run a
206
- * [$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest) when changes are
207
- * detected in the Angular part of the application.
208
- *
209
- * What this means is that applications using `UpgradeModule` will run change detection more
210
- * frequently in order to ensure that both frameworks are properly notified about possible changes.
211
- * This will inevitably result in more change detection runs than necessary.
212
- *
213
- * `downgradeModule()`, on the other side, does not try to tie the two change detection systems as
214
- * tightly, restricting the explicit change detection runs only to cases where it knows it is
215
- * necessary (e.g. when the inputs of a downgraded component change). This improves performance,
216
- * especially in change-detection-heavy applications, but leaves it up to the developer to manually
217
- * notify each framework as needed.
218
- *
219
- * For a more detailed discussion of the differences and their implications, see
220
- * [Upgrading for Performance](guide/upgrade-performance).
221
- *
222
- * <div class="alert is-helpful">
223
- *
224
- * You can manually trigger a change detection run in AngularJS using
225
- * [scope.$apply(...)](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$apply) or
226
- * [$rootScope.$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest).
227
- *
228
- * You can manually trigger a change detection run in Angular using {@link NgZone#run
229
- * ngZone.run(...)}.
230
- *
231
- * </div>
232
- *
233
- * ### Downgrading multiple modules
234
- *
235
- * It is possible to downgrade multiple modules and include them in an AngularJS application. In
236
- * that case, each downgraded module will be bootstrapped when an associated downgraded component or
237
- * injectable needs to be instantiated.
238
- *
239
- * Things to keep in mind, when downgrading multiple modules:
240
- *
241
- * - Each downgraded component/injectable needs to be explicitly associated with a downgraded
242
- * module. See `downgradeComponent()` and `downgradeInjectable()` for more details.
243
- *
244
- * - If you want some injectables to be shared among all downgraded modules, you can provide them as
245
- * `StaticProvider`s, when creating the `PlatformRef` (e.g. via `platformBrowser` or
246
- * `platformBrowserDynamic`).
247
- *
248
- * - When using {@link PlatformRef#bootstrapmodule `bootstrapModule()`} or
249
- * {@link PlatformRef#bootstrapmodulefactory `bootstrapModuleFactory()`} to bootstrap the
250
- * downgraded modules, each one is considered a "root" module. As a consequence, a new instance
251
- * will be created for every injectable provided in `"root"` (via
252
- * {@link Injectable#providedIn `providedIn`}).
253
- * If this is not your intention, you can have a shared module (that will act as act as the "root"
254
- * module) and create all downgraded modules using that module's injector:
255
- *
256
- * {@example upgrade/static/ts/lite-multi-shared/module.ts region="shared-root-module"}
257
- *
258
- * @publicApi
259
- */
260
- export declare function downgradeModule<T>(moduleOrBootstrapFn: Type<T> | ((extraProviders: StaticProvider[]) => Promise<NgModuleRef<T>>)): string;
261
-
262
- /**
263
- * @description
264
- *
265
- * A helper function for creating an AngularJS module that can bootstrap an Angular module
266
- * "on-demand" (possibly lazily) when a {@link downgradeComponent downgraded component} needs to be
267
- * instantiated.
268
- *
269
- * *Part of the [upgrade/static](api?query=upgrade/static) library for hybrid upgrade apps that
270
- * support AOT compilation.*
271
- *
272
- * It allows loading/bootstrapping the Angular part of a hybrid application lazily and not having to
273
- * pay the cost up-front. For example, you can have an AngularJS application that uses Angular for
274
- * specific routes and only instantiate the Angular modules if/when the user visits one of these
275
- * routes.
276
- *
277
- * The Angular module will be bootstrapped once (when requested for the first time) and the same
278
- * reference will be used from that point onwards.
279
- *
280
- * `downgradeModule()` requires either an `NgModuleFactory`, `NgModule` class or a function:
281
- * - `NgModuleFactory`: If you pass an `NgModuleFactory`, it will be used to instantiate a module
282
- * using `platformBrowser`'s {@link PlatformRef#bootstrapModuleFactory bootstrapModuleFactory()}.
283
- * NOTE: this type of the argument is deprecated. Please either provide an `NgModule` class or a
284
- * bootstrap function instead.
285
- * - `NgModule` class: If you pass an NgModule class, it will be used to instantiate a module
286
- * using `platformBrowser`'s {@link PlatformRef#bootstrapModule bootstrapModule()}.
287
- * - `Function`: If you pass a function, it is expected to return a promise resolving to an
288
- * `NgModuleRef`. The function is called with an array of extra {@link StaticProvider Providers}
289
- * that are expected to be available from the returned `NgModuleRef`'s `Injector`.
290
- *
291
- * `downgradeModule()` returns the name of the created AngularJS wrapper module. You can use it to
292
- * declare a dependency in your main AngularJS module.
293
- *
294
- * {@example upgrade/static/ts/lite/module.ts region="basic-how-to"}
295
- *
296
- * For more details on how to use `downgradeModule()` see
297
- * [Upgrading for Performance](guide/upgrade-performance).
298
- *
299
- * @usageNotes
300
- *
301
- * Apart from `UpgradeModule`, you can use the rest of the `upgrade/static` helpers as usual to
302
- * build a hybrid application. Note that the Angular pieces (e.g. downgraded services) will not be
303
- * available until the downgraded module has been bootstrapped, i.e. by instantiating a downgraded
304
- * component.
305
- *
306
- * <div class="alert is-important">
307
- *
308
- * You cannot use `downgradeModule()` and `UpgradeModule` in the same hybrid application.<br />
309
- * Use one or the other.
310
- *
311
- * </div>
312
- *
313
- * ### Differences with `UpgradeModule`
314
- *
315
- * Besides their different API, there are two important internal differences between
316
- * `downgradeModule()` and `UpgradeModule` that affect the behavior of hybrid applications:
317
- *
318
- * 1. Unlike `UpgradeModule`, `downgradeModule()` does not bootstrap the main AngularJS module
319
- * inside the {@link NgZone Angular zone}.
320
- * 2. Unlike `UpgradeModule`, `downgradeModule()` does not automatically run a
321
- * [$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest) when changes are
322
- * detected in the Angular part of the application.
323
- *
324
- * What this means is that applications using `UpgradeModule` will run change detection more
325
- * frequently in order to ensure that both frameworks are properly notified about possible changes.
326
- * This will inevitably result in more change detection runs than necessary.
327
- *
328
- * `downgradeModule()`, on the other side, does not try to tie the two change detection systems as
329
- * tightly, restricting the explicit change detection runs only to cases where it knows it is
330
- * necessary (e.g. when the inputs of a downgraded component change). This improves performance,
331
- * especially in change-detection-heavy applications, but leaves it up to the developer to manually
332
- * notify each framework as needed.
333
- *
334
- * For a more detailed discussion of the differences and their implications, see
335
- * [Upgrading for Performance](guide/upgrade-performance).
336
- *
337
- * <div class="alert is-helpful">
338
- *
339
- * You can manually trigger a change detection run in AngularJS using
340
- * [scope.$apply(...)](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$apply) or
341
- * [$rootScope.$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest).
342
- *
343
- * You can manually trigger a change detection run in Angular using {@link NgZone#run
344
- * ngZone.run(...)}.
345
- *
346
- * </div>
347
- *
348
- * ### Downgrading multiple modules
349
- *
350
- * It is possible to downgrade multiple modules and include them in an AngularJS application. In
351
- * that case, each downgraded module will be bootstrapped when an associated downgraded component or
352
- * injectable needs to be instantiated.
353
- *
354
- * Things to keep in mind, when downgrading multiple modules:
355
- *
356
- * - Each downgraded component/injectable needs to be explicitly associated with a downgraded
357
- * module. See `downgradeComponent()` and `downgradeInjectable()` for more details.
358
- *
359
- * - If you want some injectables to be shared among all downgraded modules, you can provide them as
360
- * `StaticProvider`s, when creating the `PlatformRef` (e.g. via `platformBrowser` or
361
- * `platformBrowserDynamic`).
362
- *
363
- * - When using {@link PlatformRef#bootstrapmodule `bootstrapModule()`} or
364
- * {@link PlatformRef#bootstrapmodulefactory `bootstrapModuleFactory()`} to bootstrap the
365
- * downgraded modules, each one is considered a "root" module. As a consequence, a new instance
366
- * will be created for every injectable provided in `"root"` (via
367
- * {@link Injectable#providedIn `providedIn`}).
368
- * If this is not your intention, you can have a shared module (that will act as act as the "root"
369
- * module) and create all downgraded modules using that module's injector:
370
- *
371
- * {@example upgrade/static/ts/lite-multi-shared/module.ts region="shared-root-module"}
372
- *
373
- * @publicApi
374
- *
375
- * @deprecated Passing `NgModuleFactory` as the `downgradeModule` function argument is deprecated,
376
- * please pass an NgModule class reference instead.
377
- */
378
- export declare function downgradeModule<T>(moduleOrBootstrapFn: NgModuleFactory<T>): string;
379
-
380
- /**
381
- * Returns the current AngularJS global.
382
- *
383
- * @publicApi
384
- */
385
- export declare function getAngularJSGlobal(): any;
386
-
387
- /**
388
- * @deprecated Use `getAngularJSGlobal` instead.
389
- *
390
- * @publicApi
391
- */
392
- export declare function getAngularLib(): any;
393
-
394
- /**
395
- * Resets the AngularJS global.
396
- *
397
- * Used when AngularJS is loaded lazily, and not available on `window`.
398
- *
399
- * @publicApi
400
- */
401
- export declare function setAngularJSGlobal(ng: any): void;
402
-
403
- /**
404
- * @deprecated Use `setAngularJSGlobal` instead.
405
- *
406
- * @publicApi
407
- */
408
- export declare function setAngularLib(ng: any): void;
409
-
410
- /**
411
- * @description
412
- *
413
- * A helper class that allows an AngularJS component to be used from Angular.
414
- *
415
- * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)
416
- * library for hybrid upgrade apps that support AOT compilation.*
417
- *
418
- * This helper class should be used as a base class for creating Angular directives
419
- * that wrap AngularJS components that need to be "upgraded".
420
- *
421
- * @usageNotes
422
- * ### Examples
423
- *
424
- * Let's assume that you have an AngularJS component called `ng1Hero` that needs
425
- * to be made available in Angular templates.
426
- *
427
- * {@example upgrade/static/ts/full/module.ts region="ng1-hero"}
428
- *
429
- * We must create a `Directive` that will make this AngularJS component
430
- * available inside Angular templates.
431
- *
432
- * {@example upgrade/static/ts/full/module.ts region="ng1-hero-wrapper"}
433
- *
434
- * In this example you can see that we must derive from the `UpgradeComponent`
435
- * base class but also provide an {@link Directive `@Directive`} decorator. This is
436
- * because the AOT compiler requires that this information is statically available at
437
- * compile time.
438
- *
439
- * Note that we must do the following:
440
- * * specify the directive's selector (`ng1-hero`)
441
- * * specify all inputs and outputs that the AngularJS component expects
442
- * * derive from `UpgradeComponent`
443
- * * call the base class from the constructor, passing
444
- * * the AngularJS name of the component (`ng1Hero`)
445
- * * the `ElementRef` and `Injector` for the component wrapper
446
- *
447
- * @publicApi
448
- * @extensible
449
- */
450
- export declare class UpgradeComponent implements OnInit, OnChanges, DoCheck, OnDestroy {
451
- private name;
452
- private elementRef;
453
- private injector;
454
- private helper;
455
- private $injector;
456
- private element;
457
- private $element;
458
- private $componentScope;
459
- private directive;
460
- private bindings;
461
- private controllerInstance;
462
- private bindingDestination;
463
- private pendingChanges;
464
- private unregisterDoCheckWatcher;
465
- /**
466
- * Create a new `UpgradeComponent` instance. You should not normally need to do this.
467
- * Instead you should derive a new class from this one and call the super constructor
468
- * from the base class.
469
- *
470
- * {@example upgrade/static/ts/full/module.ts region="ng1-hero-wrapper" }
471
- *
472
- * * The `name` parameter should be the name of the AngularJS directive.
473
- * * The `elementRef` and `injector` parameters should be acquired from Angular by dependency
474
- * injection into the base class constructor.
475
- */
476
- constructor(name: string, elementRef: ElementRef, injector: Injector);
477
- ngOnInit(): void;
478
- ngOnChanges(changes: SimpleChanges): void;
479
- ngDoCheck(): void;
480
- ngOnDestroy(): void;
481
- private initializeBindings;
482
- private initializeOutputs;
483
- private bindOutputs;
484
- private forwardChanges;
485
- static ɵfac: i0.ɵɵFactoryDeclaration<UpgradeComponent, never>;
486
- static ɵdir: i0.ɵɵDirectiveDeclaration<UpgradeComponent, never, never, {}, {}, never>;
487
- }
488
-
489
- /**
490
- * @description
491
- *
492
- * An `NgModule`, which you import to provide AngularJS core services,
493
- * and has an instance method used to bootstrap the hybrid upgrade application.
494
- *
495
- * *Part of the [upgrade/static](api?query=upgrade/static)
496
- * library for hybrid upgrade apps that support AOT compilation*
497
- *
498
- * The `upgrade/static` package contains helpers that allow AngularJS and Angular components
499
- * to be used together inside a hybrid upgrade application, which supports AOT compilation.
500
- *
501
- * Specifically, the classes and functions in the `upgrade/static` module allow the following:
502
- *
503
- * 1. Creation of an Angular directive that wraps and exposes an AngularJS component so
504
- * that it can be used in an Angular template. See `UpgradeComponent`.
505
- * 2. Creation of an AngularJS directive that wraps and exposes an Angular component so
506
- * that it can be used in an AngularJS template. See `downgradeComponent`.
507
- * 3. Creation of an Angular root injector provider that wraps and exposes an AngularJS
508
- * service so that it can be injected into an Angular context. See
509
- * {@link UpgradeModule#upgrading-an-angular-1-service Upgrading an AngularJS service} below.
510
- * 4. Creation of an AngularJS service that wraps and exposes an Angular injectable
511
- * so that it can be injected into an AngularJS context. See `downgradeInjectable`.
512
- * 3. Bootstrapping of a hybrid Angular application which contains both of the frameworks
513
- * coexisting in a single application.
514
- *
515
- * @usageNotes
516
- *
517
- * ```ts
518
- * import {UpgradeModule} from '@angular/upgrade/static';
519
- * ```
520
- *
521
- * See also the {@link UpgradeModule#examples examples} below.
522
- *
523
- * ### Mental Model
524
- *
525
- * When reasoning about how a hybrid application works it is useful to have a mental model which
526
- * describes what is happening and explains what is happening at the lowest level.
527
- *
528
- * 1. There are two independent frameworks running in a single application, each framework treats
529
- * the other as a black box.
530
- * 2. Each DOM element on the page is owned exactly by one framework. Whichever framework
531
- * instantiated the element is the owner. Each framework only updates/interacts with its own
532
- * DOM elements and ignores others.
533
- * 3. AngularJS directives always execute inside the AngularJS framework codebase regardless of
534
- * where they are instantiated.
535
- * 4. Angular components always execute inside the Angular framework codebase regardless of
536
- * where they are instantiated.
537
- * 5. An AngularJS component can be "upgraded"" to an Angular component. This is achieved by
538
- * defining an Angular directive, which bootstraps the AngularJS component at its location
539
- * in the DOM. See `UpgradeComponent`.
540
- * 6. An Angular component can be "downgraded" to an AngularJS component. This is achieved by
541
- * defining an AngularJS directive, which bootstraps the Angular component at its location
542
- * in the DOM. See `downgradeComponent`.
543
- * 7. Whenever an "upgraded"/"downgraded" component is instantiated the host element is owned by
544
- * the framework doing the instantiation. The other framework then instantiates and owns the
545
- * view for that component.
546
- * 1. This implies that the component bindings will always follow the semantics of the
547
- * instantiation framework.
548
- * 2. The DOM attributes are parsed by the framework that owns the current template. So
549
- * attributes in AngularJS templates must use kebab-case, while AngularJS templates must use
550
- * camelCase.
551
- * 3. However the template binding syntax will always use the Angular style, e.g. square
552
- * brackets (`[...]`) for property binding.
553
- * 8. Angular is bootstrapped first; AngularJS is bootstrapped second. AngularJS always owns the
554
- * root component of the application.
555
- * 9. The new application is running in an Angular zone, and therefore it no longer needs calls to
556
- * `$apply()`.
557
- *
558
- * ### The `UpgradeModule` class
559
- *
560
- * This class is an `NgModule`, which you import to provide AngularJS core services,
561
- * and has an instance method used to bootstrap the hybrid upgrade application.
562
- *
563
- * * Core AngularJS services
564
- * Importing this `NgModule` will add providers for the core
565
- * [AngularJS services](https://docs.angularjs.org/api/ng/service) to the root injector.
566
- *
567
- * * Bootstrap
568
- * The runtime instance of this class contains a {@link UpgradeModule#bootstrap `bootstrap()`}
569
- * method, which you use to bootstrap the top level AngularJS module onto an element in the
570
- * DOM for the hybrid upgrade app.
571
- *
572
- * It also contains properties to access the {@link UpgradeModule#injector root injector}, the
573
- * bootstrap `NgZone` and the
574
- * [AngularJS $injector](https://docs.angularjs.org/api/auto/service/$injector).
575
- *
576
- * ### Examples
577
- *
578
- * Import the `UpgradeModule` into your top level {@link NgModule Angular `NgModule`}.
579
- *
580
- * {@example upgrade/static/ts/full/module.ts region='ng2-module'}
581
- *
582
- * Then inject `UpgradeModule` into your Angular `NgModule` and use it to bootstrap the top level
583
- * [AngularJS module](https://docs.angularjs.org/api/ng/type/angular.Module) in the
584
- * `ngDoBootstrap()` method.
585
- *
586
- * {@example upgrade/static/ts/full/module.ts region='bootstrap-ng1'}
587
- *
588
- * Finally, kick off the whole process, by bootstrapping your top level Angular `NgModule`.
589
- *
590
- * {@example upgrade/static/ts/full/module.ts region='bootstrap-ng2'}
591
- *
592
- * {@a upgrading-an-angular-1-service}
593
- * ### Upgrading an AngularJS service
594
- *
595
- * There is no specific API for upgrading an AngularJS service. Instead you should just follow the
596
- * following recipe:
597
- *
598
- * Let's say you have an AngularJS service:
599
- *
600
- * {@example upgrade/static/ts/full/module.ts region="ng1-text-formatter-service"}
601
- *
602
- * Then you should define an Angular provider to be included in your `NgModule` `providers`
603
- * property.
604
- *
605
- * {@example upgrade/static/ts/full/module.ts region="upgrade-ng1-service"}
606
- *
607
- * Then you can use the "upgraded" AngularJS service by injecting it into an Angular component
608
- * or service.
609
- *
610
- * {@example upgrade/static/ts/full/module.ts region="use-ng1-upgraded-service"}
611
- *
612
- * @publicApi
613
- */
614
- export declare class UpgradeModule {
615
- /** The bootstrap zone for the upgrade application */
616
- ngZone: NgZone;
617
- /**
618
- * The owning `NgModuleRef`s `PlatformRef` instance.
619
- * This is used to tie the lifecycle of the bootstrapped AngularJS apps to that of the Angular
620
- * `PlatformRef`.
621
- */
622
- private platformRef;
623
- /**
624
- * The AngularJS `$injector` for the upgrade application.
625
- */
626
- $injector: any;
627
- /** The Angular Injector **/
628
- injector: Injector;
629
- constructor(
630
- /** The root `Injector` for the upgrade application. */
631
- injector: Injector,
632
- /** The bootstrap zone for the upgrade application */
633
- ngZone: NgZone,
634
- /**
635
- * The owning `NgModuleRef`s `PlatformRef` instance.
636
- * This is used to tie the lifecycle of the bootstrapped AngularJS apps to that of the Angular
637
- * `PlatformRef`.
638
- */
639
- platformRef: PlatformRef);
640
- /**
641
- * Bootstrap an AngularJS application from this NgModule
642
- * @param element the element on which to bootstrap the AngularJS application
643
- * @param [modules] the AngularJS modules to bootstrap for this application
644
- * @param [config] optional extra AngularJS bootstrap configuration
645
- */
646
- bootstrap(element: Element, modules?: string[], config?: any): void;
647
- static ɵfac: i0.ɵɵFactoryDeclaration<UpgradeModule, never>;
648
- static ɵmod: i0.ɵɵNgModuleDeclaration<UpgradeModule, never, never, never>;
649
- static ɵinj: i0.ɵɵInjectorDeclaration<UpgradeModule>;
650
- }
651
-
652
- /**
653
- * @publicApi
654
- */
655
- export declare const VERSION: Version;
656
-
657
- export { }
7
+
8
+ import { DoCheck } from '@angular/core';
9
+ import { ElementRef } from '@angular/core';
10
+ import * as i0 from '@angular/core';
11
+ import { Injector } from '@angular/core';
12
+ import { NgModuleFactory } from '@angular/core';
13
+ import { NgModuleRef } from '@angular/core';
14
+ import { NgZone } from '@angular/core';
15
+ import { OnChanges } from '@angular/core';
16
+ import { OnDestroy } from '@angular/core';
17
+ import { OnInit } from '@angular/core';
18
+ import { PlatformRef } from '@angular/core';
19
+ import { SimpleChanges } from '@angular/core';
20
+ import { StaticProvider } from '@angular/core';
21
+ import { Type } from '@angular/core';
22
+ import { Version } from '@angular/core';
23
+
24
+ /**
25
+ * @description
26
+ *
27
+ * A helper function that allows an Angular component to be used from AngularJS.
28
+ *
29
+ * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)
30
+ * library for hybrid upgrade apps that support AOT compilation*
31
+ *
32
+ * This helper function returns a factory function to be used for registering
33
+ * an AngularJS wrapper directive for "downgrading" an Angular component.
34
+ *
35
+ * @usageNotes
36
+ * ### Examples
37
+ *
38
+ * Let's assume that you have an Angular component called `ng2Heroes` that needs
39
+ * to be made available in AngularJS templates.
40
+ *
41
+ * {@example upgrade/static/ts/full/module.ts region="ng2-heroes"}
42
+ *
43
+ * We must create an AngularJS [directive](https://docs.angularjs.org/guide/directive)
44
+ * that will make this Angular component available inside AngularJS templates.
45
+ * The `downgradeComponent()` function returns a factory function that we
46
+ * can use to define the AngularJS directive that wraps the "downgraded" component.
47
+ *
48
+ * {@example upgrade/static/ts/full/module.ts region="ng2-heroes-wrapper"}
49
+ *
50
+ * For more details and examples on downgrading Angular components to AngularJS components please
51
+ * visit the [Upgrade guide](guide/upgrade#using-angular-components-from-angularjs-code).
52
+ *
53
+ * @param info contains information about the Component that is being downgraded:
54
+ *
55
+ * - `component: Type<any>`: The type of the Component that will be downgraded
56
+ * - `downgradedModule?: string`: The name of the downgraded module (if any) that the component
57
+ * "belongs to", as returned by a call to `downgradeModule()`. It is the module, whose
58
+ * corresponding Angular module will be bootstrapped, when the component needs to be instantiated.
59
+ * <br />
60
+ * (This option is only necessary when using `downgradeModule()` to downgrade more than one
61
+ * Angular module.)
62
+ * - `propagateDigest?: boolean`: Whether to perform {@link ChangeDetectorRef#detectChanges
63
+ * change detection} on the component on every
64
+ * [$digest](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest). If set to `false`,
65
+ * change detection will still be performed when any of the component's inputs changes.
66
+ * (Default: true)
67
+ *
68
+ * @returns a factory function that can be used to register the component in an
69
+ * AngularJS module.
70
+ *
71
+ * @publicApi
72
+ */
73
+ export declare function downgradeComponent(info: {
74
+ component: Type<any>;
75
+ downgradedModule?: string;
76
+ propagateDigest?: boolean;
77
+ /** @deprecated since v4. This parameter is no longer used */
78
+ inputs?: string[];
79
+ /** @deprecated since v4. This parameter is no longer used */
80
+ outputs?: string[];
81
+ /** @deprecated since v4. This parameter is no longer used */
82
+ selectors?: string[];
83
+ }): any;
84
+
85
+
86
+ /**
87
+ * @description
88
+ *
89
+ * A helper function to allow an Angular service to be accessible from AngularJS.
90
+ *
91
+ * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)
92
+ * library for hybrid upgrade apps that support AOT compilation*
93
+ *
94
+ * This helper function returns a factory function that provides access to the Angular
95
+ * service identified by the `token` parameter.
96
+ *
97
+ * @usageNotes
98
+ * ### Examples
99
+ *
100
+ * First ensure that the service to be downgraded is provided in an `NgModule`
101
+ * that will be part of the upgrade application. For example, let's assume we have
102
+ * defined `HeroesService`
103
+ *
104
+ * {@example upgrade/static/ts/full/module.ts region="ng2-heroes-service"}
105
+ *
106
+ * and that we have included this in our upgrade app `NgModule`
107
+ *
108
+ * {@example upgrade/static/ts/full/module.ts region="ng2-module"}
109
+ *
110
+ * Now we can register the `downgradeInjectable` factory function for the service
111
+ * on an AngularJS module.
112
+ *
113
+ * {@example upgrade/static/ts/full/module.ts region="downgrade-ng2-heroes-service"}
114
+ *
115
+ * Inside an AngularJS component's controller we can get hold of the
116
+ * downgraded service via the name we gave when downgrading.
117
+ *
118
+ * {@example upgrade/static/ts/full/module.ts region="example-app"}
119
+ *
120
+ * <div class="alert is-important">
121
+ *
122
+ * When using `downgradeModule()`, downgraded injectables will not be available until the Angular
123
+ * module that provides them is instantiated. In order to be safe, you need to ensure that the
124
+ * downgraded injectables are not used anywhere _outside_ the part of the app where it is
125
+ * guaranteed that their module has been instantiated.
126
+ *
127
+ * For example, it is _OK_ to use a downgraded service in an upgraded component that is only used
128
+ * from a downgraded Angular component provided by the same Angular module as the injectable, but
129
+ * it is _not OK_ to use it in an AngularJS component that may be used independently of Angular or
130
+ * use it in a downgraded Angular component from a different module.
131
+ *
132
+ * </div>
133
+ *
134
+ * @param token an `InjectionToken` that identifies a service provided from Angular.
135
+ * @param downgradedModule the name of the downgraded module (if any) that the injectable
136
+ * "belongs to", as returned by a call to `downgradeModule()`. It is the module, whose injector will
137
+ * be used for instantiating the injectable.<br />
138
+ * (This option is only necessary when using `downgradeModule()` to downgrade more than one Angular
139
+ * module.)
140
+ *
141
+ * @returns a [factory function](https://docs.angularjs.org/guide/di) that can be
142
+ * used to register the service on an AngularJS module.
143
+ *
144
+ * @publicApi
145
+ */
146
+ export declare function downgradeInjectable(token: any, downgradedModule?: string): Function;
147
+
148
+ /**
149
+ * @description
150
+ *
151
+ * A helper function for creating an AngularJS module that can bootstrap an Angular module
152
+ * "on-demand" (possibly lazily) when a {@link downgradeComponent downgraded component} needs to be
153
+ * instantiated.
154
+ *
155
+ * *Part of the [upgrade/static](api?query=upgrade/static) library for hybrid upgrade apps that
156
+ * support AOT compilation.*
157
+ *
158
+ * It allows loading/bootstrapping the Angular part of a hybrid application lazily and not having to
159
+ * pay the cost up-front. For example, you can have an AngularJS application that uses Angular for
160
+ * specific routes and only instantiate the Angular modules if/when the user visits one of these
161
+ * routes.
162
+ *
163
+ * The Angular module will be bootstrapped once (when requested for the first time) and the same
164
+ * reference will be used from that point onwards.
165
+ *
166
+ * `downgradeModule()` requires either an `NgModuleFactory`, `NgModule` class or a function:
167
+ * - `NgModuleFactory`: If you pass an `NgModuleFactory`, it will be used to instantiate a module
168
+ * using `platformBrowser`'s {@link PlatformRef#bootstrapModuleFactory bootstrapModuleFactory()}.
169
+ * NOTE: this type of the argument is deprecated. Please either provide an `NgModule` class or a
170
+ * bootstrap function instead.
171
+ * - `NgModule` class: If you pass an NgModule class, it will be used to instantiate a module
172
+ * using `platformBrowser`'s {@link PlatformRef#bootstrapModule bootstrapModule()}.
173
+ * - `Function`: If you pass a function, it is expected to return a promise resolving to an
174
+ * `NgModuleRef`. The function is called with an array of extra {@link StaticProvider Providers}
175
+ * that are expected to be available from the returned `NgModuleRef`'s `Injector`.
176
+ *
177
+ * `downgradeModule()` returns the name of the created AngularJS wrapper module. You can use it to
178
+ * declare a dependency in your main AngularJS module.
179
+ *
180
+ * {@example upgrade/static/ts/lite/module.ts region="basic-how-to"}
181
+ *
182
+ * For more details on how to use `downgradeModule()` see
183
+ * [Upgrading for Performance](guide/upgrade-performance).
184
+ *
185
+ * @usageNotes
186
+ *
187
+ * Apart from `UpgradeModule`, you can use the rest of the `upgrade/static` helpers as usual to
188
+ * build a hybrid application. Note that the Angular pieces (e.g. downgraded services) will not be
189
+ * available until the downgraded module has been bootstrapped, i.e. by instantiating a downgraded
190
+ * component.
191
+ *
192
+ * <div class="alert is-important">
193
+ *
194
+ * You cannot use `downgradeModule()` and `UpgradeModule` in the same hybrid application.<br />
195
+ * Use one or the other.
196
+ *
197
+ * </div>
198
+ *
199
+ * ### Differences with `UpgradeModule`
200
+ *
201
+ * Besides their different API, there are two important internal differences between
202
+ * `downgradeModule()` and `UpgradeModule` that affect the behavior of hybrid applications:
203
+ *
204
+ * 1. Unlike `UpgradeModule`, `downgradeModule()` does not bootstrap the main AngularJS module
205
+ * inside the {@link NgZone Angular zone}.
206
+ * 2. Unlike `UpgradeModule`, `downgradeModule()` does not automatically run a
207
+ * [$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest) when changes are
208
+ * detected in the Angular part of the application.
209
+ *
210
+ * What this means is that applications using `UpgradeModule` will run change detection more
211
+ * frequently in order to ensure that both frameworks are properly notified about possible changes.
212
+ * This will inevitably result in more change detection runs than necessary.
213
+ *
214
+ * `downgradeModule()`, on the other side, does not try to tie the two change detection systems as
215
+ * tightly, restricting the explicit change detection runs only to cases where it knows it is
216
+ * necessary (e.g. when the inputs of a downgraded component change). This improves performance,
217
+ * especially in change-detection-heavy applications, but leaves it up to the developer to manually
218
+ * notify each framework as needed.
219
+ *
220
+ * For a more detailed discussion of the differences and their implications, see
221
+ * [Upgrading for Performance](guide/upgrade-performance).
222
+ *
223
+ * <div class="alert is-helpful">
224
+ *
225
+ * You can manually trigger a change detection run in AngularJS using
226
+ * [scope.$apply(...)](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$apply) or
227
+ * [$rootScope.$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest).
228
+ *
229
+ * You can manually trigger a change detection run in Angular using {@link NgZone#run
230
+ * ngZone.run(...)}.
231
+ *
232
+ * </div>
233
+ *
234
+ * ### Downgrading multiple modules
235
+ *
236
+ * It is possible to downgrade multiple modules and include them in an AngularJS application. In
237
+ * that case, each downgraded module will be bootstrapped when an associated downgraded component or
238
+ * injectable needs to be instantiated.
239
+ *
240
+ * Things to keep in mind, when downgrading multiple modules:
241
+ *
242
+ * - Each downgraded component/injectable needs to be explicitly associated with a downgraded
243
+ * module. See `downgradeComponent()` and `downgradeInjectable()` for more details.
244
+ *
245
+ * - If you want some injectables to be shared among all downgraded modules, you can provide them as
246
+ * `StaticProvider`s, when creating the `PlatformRef` (e.g. via `platformBrowser` or
247
+ * `platformBrowserDynamic`).
248
+ *
249
+ * - When using {@link PlatformRef#bootstrapmodule `bootstrapModule()`} or
250
+ * {@link PlatformRef#bootstrapmodulefactory `bootstrapModuleFactory()`} to bootstrap the
251
+ * downgraded modules, each one is considered a "root" module. As a consequence, a new instance
252
+ * will be created for every injectable provided in `"root"` (via
253
+ * {@link Injectable#providedIn `providedIn`}).
254
+ * If this is not your intention, you can have a shared module (that will act as act as the "root"
255
+ * module) and create all downgraded modules using that module's injector:
256
+ *
257
+ * {@example upgrade/static/ts/lite-multi-shared/module.ts region="shared-root-module"}
258
+ *
259
+ * @publicApi
260
+ */
261
+ export declare function downgradeModule<T>(moduleOrBootstrapFn: Type<T> | ((extraProviders: StaticProvider[]) => Promise<NgModuleRef<T>>)): string;
262
+
263
+ /**
264
+ * @description
265
+ *
266
+ * A helper function for creating an AngularJS module that can bootstrap an Angular module
267
+ * "on-demand" (possibly lazily) when a {@link downgradeComponent downgraded component} needs to be
268
+ * instantiated.
269
+ *
270
+ * *Part of the [upgrade/static](api?query=upgrade/static) library for hybrid upgrade apps that
271
+ * support AOT compilation.*
272
+ *
273
+ * It allows loading/bootstrapping the Angular part of a hybrid application lazily and not having to
274
+ * pay the cost up-front. For example, you can have an AngularJS application that uses Angular for
275
+ * specific routes and only instantiate the Angular modules if/when the user visits one of these
276
+ * routes.
277
+ *
278
+ * The Angular module will be bootstrapped once (when requested for the first time) and the same
279
+ * reference will be used from that point onwards.
280
+ *
281
+ * `downgradeModule()` requires either an `NgModuleFactory`, `NgModule` class or a function:
282
+ * - `NgModuleFactory`: If you pass an `NgModuleFactory`, it will be used to instantiate a module
283
+ * using `platformBrowser`'s {@link PlatformRef#bootstrapModuleFactory bootstrapModuleFactory()}.
284
+ * NOTE: this type of the argument is deprecated. Please either provide an `NgModule` class or a
285
+ * bootstrap function instead.
286
+ * - `NgModule` class: If you pass an NgModule class, it will be used to instantiate a module
287
+ * using `platformBrowser`'s {@link PlatformRef#bootstrapModule bootstrapModule()}.
288
+ * - `Function`: If you pass a function, it is expected to return a promise resolving to an
289
+ * `NgModuleRef`. The function is called with an array of extra {@link StaticProvider Providers}
290
+ * that are expected to be available from the returned `NgModuleRef`'s `Injector`.
291
+ *
292
+ * `downgradeModule()` returns the name of the created AngularJS wrapper module. You can use it to
293
+ * declare a dependency in your main AngularJS module.
294
+ *
295
+ * {@example upgrade/static/ts/lite/module.ts region="basic-how-to"}
296
+ *
297
+ * For more details on how to use `downgradeModule()` see
298
+ * [Upgrading for Performance](guide/upgrade-performance).
299
+ *
300
+ * @usageNotes
301
+ *
302
+ * Apart from `UpgradeModule`, you can use the rest of the `upgrade/static` helpers as usual to
303
+ * build a hybrid application. Note that the Angular pieces (e.g. downgraded services) will not be
304
+ * available until the downgraded module has been bootstrapped, i.e. by instantiating a downgraded
305
+ * component.
306
+ *
307
+ * <div class="alert is-important">
308
+ *
309
+ * You cannot use `downgradeModule()` and `UpgradeModule` in the same hybrid application.<br />
310
+ * Use one or the other.
311
+ *
312
+ * </div>
313
+ *
314
+ * ### Differences with `UpgradeModule`
315
+ *
316
+ * Besides their different API, there are two important internal differences between
317
+ * `downgradeModule()` and `UpgradeModule` that affect the behavior of hybrid applications:
318
+ *
319
+ * 1. Unlike `UpgradeModule`, `downgradeModule()` does not bootstrap the main AngularJS module
320
+ * inside the {@link NgZone Angular zone}.
321
+ * 2. Unlike `UpgradeModule`, `downgradeModule()` does not automatically run a
322
+ * [$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest) when changes are
323
+ * detected in the Angular part of the application.
324
+ *
325
+ * What this means is that applications using `UpgradeModule` will run change detection more
326
+ * frequently in order to ensure that both frameworks are properly notified about possible changes.
327
+ * This will inevitably result in more change detection runs than necessary.
328
+ *
329
+ * `downgradeModule()`, on the other side, does not try to tie the two change detection systems as
330
+ * tightly, restricting the explicit change detection runs only to cases where it knows it is
331
+ * necessary (e.g. when the inputs of a downgraded component change). This improves performance,
332
+ * especially in change-detection-heavy applications, but leaves it up to the developer to manually
333
+ * notify each framework as needed.
334
+ *
335
+ * For a more detailed discussion of the differences and their implications, see
336
+ * [Upgrading for Performance](guide/upgrade-performance).
337
+ *
338
+ * <div class="alert is-helpful">
339
+ *
340
+ * You can manually trigger a change detection run in AngularJS using
341
+ * [scope.$apply(...)](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$apply) or
342
+ * [$rootScope.$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest).
343
+ *
344
+ * You can manually trigger a change detection run in Angular using {@link NgZone#run
345
+ * ngZone.run(...)}.
346
+ *
347
+ * </div>
348
+ *
349
+ * ### Downgrading multiple modules
350
+ *
351
+ * It is possible to downgrade multiple modules and include them in an AngularJS application. In
352
+ * that case, each downgraded module will be bootstrapped when an associated downgraded component or
353
+ * injectable needs to be instantiated.
354
+ *
355
+ * Things to keep in mind, when downgrading multiple modules:
356
+ *
357
+ * - Each downgraded component/injectable needs to be explicitly associated with a downgraded
358
+ * module. See `downgradeComponent()` and `downgradeInjectable()` for more details.
359
+ *
360
+ * - If you want some injectables to be shared among all downgraded modules, you can provide them as
361
+ * `StaticProvider`s, when creating the `PlatformRef` (e.g. via `platformBrowser` or
362
+ * `platformBrowserDynamic`).
363
+ *
364
+ * - When using {@link PlatformRef#bootstrapmodule `bootstrapModule()`} or
365
+ * {@link PlatformRef#bootstrapmodulefactory `bootstrapModuleFactory()`} to bootstrap the
366
+ * downgraded modules, each one is considered a "root" module. As a consequence, a new instance
367
+ * will be created for every injectable provided in `"root"` (via
368
+ * {@link Injectable#providedIn `providedIn`}).
369
+ * If this is not your intention, you can have a shared module (that will act as act as the "root"
370
+ * module) and create all downgraded modules using that module's injector:
371
+ *
372
+ * {@example upgrade/static/ts/lite-multi-shared/module.ts region="shared-root-module"}
373
+ *
374
+ * @publicApi
375
+ *
376
+ * @deprecated Passing `NgModuleFactory` as the `downgradeModule` function argument is deprecated,
377
+ * please pass an NgModule class reference instead.
378
+ */
379
+ export declare function downgradeModule<T>(moduleOrBootstrapFn: NgModuleFactory<T>): string;
380
+
381
+ /**
382
+ * Returns the current AngularJS global.
383
+ *
384
+ * @publicApi
385
+ */
386
+ export declare function getAngularJSGlobal(): any;
387
+
388
+ /**
389
+ * @deprecated Use `getAngularJSGlobal` instead.
390
+ *
391
+ * @publicApi
392
+ */
393
+ export declare function getAngularLib(): any;
394
+
395
+ /**
396
+ * Resets the AngularJS global.
397
+ *
398
+ * Used when AngularJS is loaded lazily, and not available on `window`.
399
+ *
400
+ * @publicApi
401
+ */
402
+ export declare function setAngularJSGlobal(ng: any): void;
403
+
404
+ /**
405
+ * @deprecated Use `setAngularJSGlobal` instead.
406
+ *
407
+ * @publicApi
408
+ */
409
+ export declare function setAngularLib(ng: any): void;
410
+
411
+ /**
412
+ * @description
413
+ *
414
+ * A helper class that allows an AngularJS component to be used from Angular.
415
+ *
416
+ * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)
417
+ * library for hybrid upgrade apps that support AOT compilation.*
418
+ *
419
+ * This helper class should be used as a base class for creating Angular directives
420
+ * that wrap AngularJS components that need to be "upgraded".
421
+ *
422
+ * @usageNotes
423
+ * ### Examples
424
+ *
425
+ * Let's assume that you have an AngularJS component called `ng1Hero` that needs
426
+ * to be made available in Angular templates.
427
+ *
428
+ * {@example upgrade/static/ts/full/module.ts region="ng1-hero"}
429
+ *
430
+ * We must create a `Directive` that will make this AngularJS component
431
+ * available inside Angular templates.
432
+ *
433
+ * {@example upgrade/static/ts/full/module.ts region="ng1-hero-wrapper"}
434
+ *
435
+ * In this example you can see that we must derive from the `UpgradeComponent`
436
+ * base class but also provide an {@link Directive `@Directive`} decorator. This is
437
+ * because the AOT compiler requires that this information is statically available at
438
+ * compile time.
439
+ *
440
+ * Note that we must do the following:
441
+ * * specify the directive's selector (`ng1-hero`)
442
+ * * specify all inputs and outputs that the AngularJS component expects
443
+ * * derive from `UpgradeComponent`
444
+ * * call the base class from the constructor, passing
445
+ * * the AngularJS name of the component (`ng1Hero`)
446
+ * * the `ElementRef` and `Injector` for the component wrapper
447
+ *
448
+ * @publicApi
449
+ * @extensible
450
+ */
451
+ export declare class UpgradeComponent implements OnInit, OnChanges, DoCheck, OnDestroy {
452
+ private name;
453
+ private elementRef;
454
+ private injector;
455
+ private helper;
456
+ private $injector;
457
+ private element;
458
+ private $element;
459
+ private $componentScope;
460
+ private directive;
461
+ private bindings;
462
+ private controllerInstance;
463
+ private bindingDestination;
464
+ private pendingChanges;
465
+ private unregisterDoCheckWatcher;
466
+ /**
467
+ * Create a new `UpgradeComponent` instance. You should not normally need to do this.
468
+ * Instead you should derive a new class from this one and call the super constructor
469
+ * from the base class.
470
+ *
471
+ * {@example upgrade/static/ts/full/module.ts region="ng1-hero-wrapper" }
472
+ *
473
+ * * The `name` parameter should be the name of the AngularJS directive.
474
+ * * The `elementRef` and `injector` parameters should be acquired from Angular by dependency
475
+ * injection into the base class constructor.
476
+ */
477
+ constructor(name: string, elementRef: ElementRef, injector: Injector);
478
+ ngOnInit(): void;
479
+ ngOnChanges(changes: SimpleChanges): void;
480
+ ngDoCheck(): void;
481
+ ngOnDestroy(): void;
482
+ private initializeBindings;
483
+ private initializeOutputs;
484
+ private bindOutputs;
485
+ private forwardChanges;
486
+ static ɵfac: i0.ɵɵFactoryDeclaration<UpgradeComponent, never>;
487
+ static ɵdir: i0.ɵɵDirectiveDeclaration<UpgradeComponent, never, never, {}, {}, never, never, false>;
488
+ }
489
+
490
+ /**
491
+ * @description
492
+ *
493
+ * An `NgModule`, which you import to provide AngularJS core services,
494
+ * and has an instance method used to bootstrap the hybrid upgrade application.
495
+ *
496
+ * *Part of the [upgrade/static](api?query=upgrade/static)
497
+ * library for hybrid upgrade apps that support AOT compilation*
498
+ *
499
+ * The `upgrade/static` package contains helpers that allow AngularJS and Angular components
500
+ * to be used together inside a hybrid upgrade application, which supports AOT compilation.
501
+ *
502
+ * Specifically, the classes and functions in the `upgrade/static` module allow the following:
503
+ *
504
+ * 1. Creation of an Angular directive that wraps and exposes an AngularJS component so
505
+ * that it can be used in an Angular template. See `UpgradeComponent`.
506
+ * 2. Creation of an AngularJS directive that wraps and exposes an Angular component so
507
+ * that it can be used in an AngularJS template. See `downgradeComponent`.
508
+ * 3. Creation of an Angular root injector provider that wraps and exposes an AngularJS
509
+ * service so that it can be injected into an Angular context. See
510
+ * {@link UpgradeModule#upgrading-an-angular-1-service Upgrading an AngularJS service} below.
511
+ * 4. Creation of an AngularJS service that wraps and exposes an Angular injectable
512
+ * so that it can be injected into an AngularJS context. See `downgradeInjectable`.
513
+ * 3. Bootstrapping of a hybrid Angular application which contains both of the frameworks
514
+ * coexisting in a single application.
515
+ *
516
+ * @usageNotes
517
+ *
518
+ * ```ts
519
+ * import {UpgradeModule} from '@angular/upgrade/static';
520
+ * ```
521
+ *
522
+ * See also the {@link UpgradeModule#examples examples} below.
523
+ *
524
+ * ### Mental Model
525
+ *
526
+ * When reasoning about how a hybrid application works it is useful to have a mental model which
527
+ * describes what is happening and explains what is happening at the lowest level.
528
+ *
529
+ * 1. There are two independent frameworks running in a single application, each framework treats
530
+ * the other as a black box.
531
+ * 2. Each DOM element on the page is owned exactly by one framework. Whichever framework
532
+ * instantiated the element is the owner. Each framework only updates/interacts with its own
533
+ * DOM elements and ignores others.
534
+ * 3. AngularJS directives always execute inside the AngularJS framework codebase regardless of
535
+ * where they are instantiated.
536
+ * 4. Angular components always execute inside the Angular framework codebase regardless of
537
+ * where they are instantiated.
538
+ * 5. An AngularJS component can be "upgraded"" to an Angular component. This is achieved by
539
+ * defining an Angular directive, which bootstraps the AngularJS component at its location
540
+ * in the DOM. See `UpgradeComponent`.
541
+ * 6. An Angular component can be "downgraded" to an AngularJS component. This is achieved by
542
+ * defining an AngularJS directive, which bootstraps the Angular component at its location
543
+ * in the DOM. See `downgradeComponent`.
544
+ * 7. Whenever an "upgraded"/"downgraded" component is instantiated the host element is owned by
545
+ * the framework doing the instantiation. The other framework then instantiates and owns the
546
+ * view for that component.
547
+ * 1. This implies that the component bindings will always follow the semantics of the
548
+ * instantiation framework.
549
+ * 2. The DOM attributes are parsed by the framework that owns the current template. So
550
+ * attributes in AngularJS templates must use kebab-case, while AngularJS templates must use
551
+ * camelCase.
552
+ * 3. However the template binding syntax will always use the Angular style, e.g. square
553
+ * brackets (`[...]`) for property binding.
554
+ * 8. Angular is bootstrapped first; AngularJS is bootstrapped second. AngularJS always owns the
555
+ * root component of the application.
556
+ * 9. The new application is running in an Angular zone, and therefore it no longer needs calls to
557
+ * `$apply()`.
558
+ *
559
+ * ### The `UpgradeModule` class
560
+ *
561
+ * This class is an `NgModule`, which you import to provide AngularJS core services,
562
+ * and has an instance method used to bootstrap the hybrid upgrade application.
563
+ *
564
+ * * Core AngularJS services
565
+ * Importing this `NgModule` will add providers for the core
566
+ * [AngularJS services](https://docs.angularjs.org/api/ng/service) to the root injector.
567
+ *
568
+ * * Bootstrap
569
+ * The runtime instance of this class contains a {@link UpgradeModule#bootstrap `bootstrap()`}
570
+ * method, which you use to bootstrap the top level AngularJS module onto an element in the
571
+ * DOM for the hybrid upgrade app.
572
+ *
573
+ * It also contains properties to access the {@link UpgradeModule#injector root injector}, the
574
+ * bootstrap `NgZone` and the
575
+ * [AngularJS $injector](https://docs.angularjs.org/api/auto/service/$injector).
576
+ *
577
+ * ### Examples
578
+ *
579
+ * Import the `UpgradeModule` into your top level {@link NgModule Angular `NgModule`}.
580
+ *
581
+ * {@example upgrade/static/ts/full/module.ts region='ng2-module'}
582
+ *
583
+ * Then inject `UpgradeModule` into your Angular `NgModule` and use it to bootstrap the top level
584
+ * [AngularJS module](https://docs.angularjs.org/api/ng/type/angular.Module) in the
585
+ * `ngDoBootstrap()` method.
586
+ *
587
+ * {@example upgrade/static/ts/full/module.ts region='bootstrap-ng1'}
588
+ *
589
+ * Finally, kick off the whole process, by bootstrapping your top level Angular `NgModule`.
590
+ *
591
+ * {@example upgrade/static/ts/full/module.ts region='bootstrap-ng2'}
592
+ *
593
+ * {@a upgrading-an-angular-1-service}
594
+ * ### Upgrading an AngularJS service
595
+ *
596
+ * There is no specific API for upgrading an AngularJS service. Instead you should just follow the
597
+ * following recipe:
598
+ *
599
+ * Let's say you have an AngularJS service:
600
+ *
601
+ * {@example upgrade/static/ts/full/module.ts region="ng1-text-formatter-service"}
602
+ *
603
+ * Then you should define an Angular provider to be included in your `NgModule` `providers`
604
+ * property.
605
+ *
606
+ * {@example upgrade/static/ts/full/module.ts region="upgrade-ng1-service"}
607
+ *
608
+ * Then you can use the "upgraded" AngularJS service by injecting it into an Angular component
609
+ * or service.
610
+ *
611
+ * {@example upgrade/static/ts/full/module.ts region="use-ng1-upgraded-service"}
612
+ *
613
+ * @publicApi
614
+ */
615
+ export declare class UpgradeModule {
616
+ /** The bootstrap zone for the upgrade application */
617
+ ngZone: NgZone;
618
+ /**
619
+ * The owning `NgModuleRef`s `PlatformRef` instance.
620
+ * This is used to tie the lifecycle of the bootstrapped AngularJS apps to that of the Angular
621
+ * `PlatformRef`.
622
+ */
623
+ private platformRef;
624
+ /**
625
+ * The AngularJS `$injector` for the upgrade application.
626
+ */
627
+ $injector: any;
628
+ /** The Angular Injector **/
629
+ injector: Injector;
630
+ constructor(
631
+ /** The root `Injector` for the upgrade application. */
632
+ injector: Injector,
633
+ /** The bootstrap zone for the upgrade application */
634
+ ngZone: NgZone,
635
+ /**
636
+ * The owning `NgModuleRef`s `PlatformRef` instance.
637
+ * This is used to tie the lifecycle of the bootstrapped AngularJS apps to that of the Angular
638
+ * `PlatformRef`.
639
+ */
640
+ platformRef: PlatformRef);
641
+ /**
642
+ * Bootstrap an AngularJS application from this NgModule
643
+ * @param element the element on which to bootstrap the AngularJS application
644
+ * @param [modules] the AngularJS modules to bootstrap for this application
645
+ * @param [config] optional extra AngularJS bootstrap configuration
646
+ */
647
+ bootstrap(element: Element, modules?: string[], config?: any): void;
648
+ static ɵfac: i0.ɵɵFactoryDeclaration<UpgradeModule, never>;
649
+ static ɵmod: i0.ɵɵNgModuleDeclaration<UpgradeModule, never, never, never>;
650
+ static ɵinj: i0.ɵɵInjectorDeclaration<UpgradeModule>;
651
+ }
652
+
653
+ /**
654
+ * @publicApi
655
+ */
656
+ export declare const VERSION: Version;
657
+
658
+ export { }