@angular/core 6.1.6 → 6.1.10

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.
Files changed (67) hide show
  1. package/bundles/core-testing.umd.js +23 -16
  2. package/bundles/core-testing.umd.js.map +1 -1
  3. package/bundles/core-testing.umd.min.js +6 -6
  4. package/bundles/core-testing.umd.min.js.map +1 -1
  5. package/bundles/core.umd.js +166 -139
  6. package/bundles/core.umd.js.map +1 -1
  7. package/bundles/core.umd.min.js +81 -81
  8. package/bundles/core.umd.min.js.map +1 -1
  9. package/core.metadata.json +1 -1
  10. package/esm2015/index.js +2 -2
  11. package/esm2015/public_api.js +2 -2
  12. package/esm2015/src/application_module.js +11 -4
  13. package/esm2015/src/change_detection/change_detector_ref.js +2 -2
  14. package/esm2015/src/core.js +2 -2
  15. package/esm2015/src/di/injection_token.js +3 -3
  16. package/esm2015/src/di/reflective_injector.js +1 -10
  17. package/esm2015/src/linker/component_factory.js +19 -16
  18. package/esm2015/src/linker/template_ref.js +20 -14
  19. package/esm2015/src/linker/view_container_ref.js +61 -68
  20. package/esm2015/src/linker/view_ref.js +29 -21
  21. package/esm2015/src/metadata/view.js +1 -4
  22. package/esm2015/src/render3/instructions.js +2 -2
  23. package/esm2015/src/render3/ng_dev_mode.js +52 -31
  24. package/esm2015/src/version.js +1 -1
  25. package/esm2015/src/zone.js +2 -2
  26. package/esm5/src/application_init.js +7 -8
  27. package/esm5/src/application_module.js +16 -10
  28. package/esm5/src/application_ref.js +15 -21
  29. package/esm5/src/change_detection/change_detector_ref.js +2 -2
  30. package/esm5/src/console.js +5 -4
  31. package/esm5/src/di/injection_token.js +3 -3
  32. package/esm5/src/di/reflective_injector.js +1 -1
  33. package/esm5/src/linker/compiler.js +5 -4
  34. package/esm5/src/linker/component_factory.js +4 -6
  35. package/esm5/src/linker/system_js_ng_module_factory_loader.js +6 -9
  36. package/esm5/src/linker/template_ref.js +13 -8
  37. package/esm5/src/linker/view_container_ref.js +9 -13
  38. package/esm5/src/linker/view_ref.js +22 -18
  39. package/esm5/src/metadata/view.js +4 -4
  40. package/esm5/src/render3/instructions.js +2 -2
  41. package/esm5/src/render3/ng_dev_mode.js +48 -27
  42. package/esm5/src/testability/testability.js +10 -13
  43. package/esm5/src/version.js +1 -1
  44. package/esm5/src/zone.js +2 -2
  45. package/esm5/testing/src/logger.js +6 -6
  46. package/esm5/testing/src/ng_zone_mock.js +5 -6
  47. package/esm5/testing/src/test_bed.js +13 -13
  48. package/esm5/testing/src/test_compiler.js +4 -4
  49. package/fesm2015/core.js +110 -84
  50. package/fesm2015/core.js.map +1 -1
  51. package/fesm2015/testing.js +1 -1
  52. package/fesm5/core.js +155 -141
  53. package/fesm5/core.js.map +1 -1
  54. package/fesm5/testing.js +17 -17
  55. package/fesm5/testing.js.map +1 -1
  56. package/package.json +1 -1
  57. package/src/application_module.d.ts +10 -2
  58. package/src/change_detection/change_detector_ref.d.ts +1 -1
  59. package/src/di/injection_token.d.ts +2 -2
  60. package/src/di/reflective_injector.d.ts +0 -9
  61. package/src/linker/component_factory.d.ts +22 -14
  62. package/src/linker/template_ref.d.ts +21 -11
  63. package/src/linker/view_container_ref.d.ts +61 -44
  64. package/src/linker/view_ref.d.ts +38 -18
  65. package/src/metadata/view.d.ts +3 -3
  66. package/src/render3/ng_dev_mode.d.ts +1 -1
  67. package/src/zone.d.ts +1 -1
@@ -8,29 +8,39 @@
8
8
  import { ElementRef } from './element_ref';
9
9
  import { EmbeddedViewRef } from './view_ref';
10
10
  /**
11
- * Represents an Embedded Template that can be used to instantiate Embedded Views.
11
+ * Represents an embedded template that can be used to instantiate embedded views.
12
+ * To instantiate embedded views based on a template, use the `ViewContainerRef`
13
+ * method `createEmbeddedView()`.
12
14
  *
13
- * You can access a `TemplateRef`, in two ways. Via a directive placed on a `<ng-template>` element
14
- * (or directive prefixed with `*`) and have the `TemplateRef` for this Embedded View injected into
15
- * the constructor of the directive using the `TemplateRef` Token. Alternatively you can query for
16
- * the `TemplateRef` from a Component or a Directive via {@link Query}.
15
+ * Access a `TemplateRef` instance by placing a directive on an `<ng-template>`
16
+ * element (or directive prefixed with `*`). The `TemplateRef` for the embedded view
17
+ * is injected into the constructor of the directive,
18
+ * using the `TemplateRef` token.
17
19
  *
18
- * To instantiate Embedded Views based on a Template, use {@link ViewContainerRef#
19
- * createEmbeddedView}, which will create the View and attach it to the View Container.
20
+ * You can also use a `Query` to find a `TemplateRef` associated with
21
+ * a component or a directive.
22
+ *
23
+ * @see `ViewContainerRef`
24
+ * @see [Navigate the Component Tree with DI](guide/dependency-injection-navtree)
20
25
  *
21
26
  */
22
27
  export declare abstract class TemplateRef<C> {
23
28
  /**
24
- * The location in the View where the Embedded View logically belongs to.
29
+ * The anchor element in the parent view for this embedded view.
25
30
  *
26
- * The data-binding and injection contexts of Embedded Views created from this `TemplateRef`
31
+ * The data-binding and injection contexts of embedded views created from this `TemplateRef`
27
32
  * inherit from the contexts of this location.
28
33
  *
29
- * Typically new Embedded Views are attached to the View Container of this location, but in
30
- * advanced use-cases, the View can be attached to a different container while keeping the
34
+ * Typically new embedded views are attached to the view container of this location, but in
35
+ * advanced use-cases, the view can be attached to a different container while keeping the
31
36
  * data-binding and injection context from the original location.
32
37
  *
33
38
  */
34
39
  abstract readonly elementRef: ElementRef;
40
+ /**
41
+ * Creates a view object and attaches it to the view container of the parent view.
42
+ * @param context The context for the new view, inherited from the anchor element.
43
+ * @returns The new view object.
44
+ */
35
45
  abstract createEmbeddedView(context: C): EmbeddedViewRef<C>;
36
46
  }
@@ -12,95 +12,112 @@ import { NgModuleRef } from './ng_module_factory';
12
12
  import { TemplateRef } from './template_ref';
13
13
  import { EmbeddedViewRef, ViewRef } from './view_ref';
14
14
  /**
15
- * Represents a container where one or more Views can be attached.
15
+ * Represents a container where one or more views can be attached to a component.
16
16
  *
17
- * The container can contain two kinds of Views. Host Views, created by instantiating a
18
- * {@link Component} via {@link #createComponent}, and Embedded Views, created by instantiating an
19
- * {@link TemplateRef Embedded Template} via {@link #createEmbeddedView}.
17
+ * Can contain *host views* (created by instantiating a
18
+ * component with the `createComponent()` method), and *embedded views*
19
+ * (created by instantiating a `TemplateRef` with the `createEmbeddedView()` method).
20
20
  *
21
- * The location of the View Container within the containing View is specified by the Anchor
22
- * `element`. Each View Container can have only one Anchor Element and each Anchor Element can only
23
- * have a single View Container.
21
+ * A view container instance can contain other view containers,
22
+ * creating a [view hierarchy](guide/glossary#view-tree).
24
23
  *
25
- * Root elements of Views attached to this container become siblings of the Anchor Element in
26
- * the Rendered View.
27
- *
28
- * To access a `ViewContainerRef` of an Element, you can either place a {@link Directive} injected
29
- * with `ViewContainerRef` on the Element, or you obtain it via a {@link ViewChild} query.
24
+ * @see `ComponentRef`
25
+ * @see `EmbeddedViewRef`
30
26
  *
31
27
  */
32
28
  export declare abstract class ViewContainerRef {
33
29
  /**
34
- * Anchor element that specifies the location of this container in the containing View.
30
+ * Anchor element that specifies the location of this container in the containing view.
31
+ * Each view container can have only one anchor element, and each anchor element
32
+ * can have only a single view container.
33
+ *
34
+ * Root elements of views attached to this container become siblings of the anchor element in
35
+ * the rendered view.
36
+ *
37
+ * Access the `ViewContainerRef` of an element by placing a `Directive` injected
38
+ * with `ViewContainerRef` on the element, or use a `ViewChild` query.
39
+ *
35
40
  * <!-- TODO: rename to anchorElement -->
36
41
  */
37
42
  abstract readonly element: ElementRef;
43
+ /**
44
+ * The [dependency injector](guide/glossary#injector) for this view container.
45
+ */
38
46
  abstract readonly injector: Injector;
39
47
  abstract readonly parentInjector: Injector;
40
48
  /**
41
- * Destroys all Views in this container.
49
+ * Destroys all views in this container.
42
50
  */
43
51
  abstract clear(): void;
44
52
  /**
45
- * Returns the {@link ViewRef} for the View located in this container at the specified index.
53
+ * Retrieves a view from this container.
54
+ * @param index The 0-based index of the view to retrieve.
55
+ * @returns The `ViewRef` instance, or null if the index is out of range.
46
56
  */
47
57
  abstract get(index: number): ViewRef | null;
48
58
  /**
49
- * Returns the number of Views currently attached to this container.
59
+ * Reports how many views are currently attached to this container.
60
+ * @returns The number of views.
50
61
  */
51
62
  abstract readonly length: number;
52
63
  /**
53
- * Instantiates an Embedded View based on the {@link TemplateRef `templateRef`} and inserts it
54
- * into this container at the specified `index`.
64
+ * Instantiates an embedded view and inserts it
65
+ * into this container.
66
+ * @param templateRef The HTML template that defines the view.
67
+ * @param index The 0-based index at which to insert the new view into this container.
68
+ * If not specified, appends the new view as the last entry.
55
69
  *
56
- * If `index` is not specified, the new View will be inserted as the last View in the container.
57
- *
58
- * Returns the {@link ViewRef} for the newly created View.
70
+ * @returns The `ViewRef` instance for the newly created view.
59
71
  */
60
72
  abstract createEmbeddedView<C>(templateRef: TemplateRef<C>, context?: C, index?: number): EmbeddedViewRef<C>;
61
73
  /**
62
- * Instantiates a single {@link Component} and inserts its Host View into this container at the
63
- * specified `index`.
64
- *
65
- * The component is instantiated using its {@link ComponentFactory} which can be obtained via
66
- * {@link ComponentFactoryResolver#resolveComponentFactory resolveComponentFactory}.
74
+ * Instantiates a single component and inserts its host view into this container.
67
75
  *
68
- * If `index` is not specified, the new View will be inserted as the last View in the container.
76
+ * @param componentFactory The factory to use.
77
+ * @param index The index at which to insert the new component's host view into this container.
78
+ * If not specified, appends the new view as the last entry.
79
+ * @param injector The injector to use as the parent for the new component.
80
+ * @param projectableNodes
81
+ * @param ngModule
69
82
  *
70
- * You can optionally specify the {@link Injector} that will be used as parent for the Component.
83
+ * @returns The new component instance, containing the host view.
71
84
  *
72
- * Returns the {@link ComponentRef} of the Host View created for the newly instantiated Component.
73
85
  */
74
86
  abstract createComponent<C>(componentFactory: ComponentFactory<C>, index?: number, injector?: Injector, projectableNodes?: any[][], ngModule?: NgModuleRef<any>): ComponentRef<C>;
75
87
  /**
76
- * Inserts a View identified by a {@link ViewRef} into the container at the specified `index`.
77
- *
78
- * If `index` is not specified, the new View will be inserted as the last View in the container.
88
+ * Inserts a view into this container.
89
+ * @param viewRef The view to insert.
90
+ * @param index The 0-based index at which to insert the view.
91
+ * If not specified, appends the new view as the last entry.
92
+ * @returns The inserted `ViewRef` instance.
79
93
  *
80
- * Returns the inserted {@link ViewRef}.
81
94
  */
82
95
  abstract insert(viewRef: ViewRef, index?: number): ViewRef;
83
96
  /**
84
- * Moves a View identified by a {@link ViewRef} into the container at the specified `index`.
85
- *
86
- * Returns the inserted {@link ViewRef}.
97
+ * Moves a view to a new location in this container.
98
+ * @param viewRef The view to move.
99
+ * @param index The 0-based index of the new location.
100
+ * @returns The moved `ViewRef` instance.
87
101
  */
88
102
  abstract move(viewRef: ViewRef, currentIndex: number): ViewRef;
89
103
  /**
90
- * Returns the index of the View, specified via {@link ViewRef}, within the current container or
91
- * `-1` if this container doesn't contain the View.
104
+ * Returns the index of a view within the current container.
105
+ * @param viewRef The view to query.
106
+ * @returns The 0-based index of the view's position in this container,
107
+ * or `-1` if this container doesn't contain the view.
92
108
  */
93
109
  abstract indexOf(viewRef: ViewRef): number;
94
110
  /**
95
- * Destroys a View attached to this container at the specified `index`.
96
- *
97
- * If `index` is not specified, the last View in the container will be removed.
111
+ * Destroys a view attached to this container
112
+ * @param index The 0-based index of the view to destroy.
113
+ * If not specified, the last view in the container is removed.
98
114
  */
99
115
  abstract remove(index?: number): void;
100
116
  /**
101
- * Use along with {@link #insert} to move a View within the current container.
102
- *
103
- * If the `index` param is omitted, the last {@link ViewRef} is detached.
117
+ * Detaches a view from this container without destroying it.
118
+ * Use along with `insert()` to move a view within the current container.
119
+ * @param index The 0-based index of the view to detach.
120
+ * If not specified, the last view in the container is detached.
104
121
  */
105
122
  abstract detach(index?: number): ViewRef | null;
106
123
  }
@@ -7,30 +7,48 @@
7
7
  */
8
8
  import { ApplicationRef } from '../application_ref';
9
9
  import { ChangeDetectorRef } from '../change_detection/change_detector_ref';
10
+ /**
11
+ * Represents an Angular [view](guide/glossary#view),
12
+ * specifically the [host view](guide/glossary#view-tree) that is defined by a component.
13
+ * Also serves as the base class
14
+ * that adds destroy methods for [embedded views](guide/glossary#view-tree).
15
+ *
16
+ * @see `EmbeddedViewRef`
17
+ */
10
18
  export declare abstract class ViewRef extends ChangeDetectorRef {
11
19
  /**
12
- * Destroys the view and all of the data structures associated with it.
20
+ * Destroys this view and all of the data structures associated with it.
13
21
  */
14
22
  abstract destroy(): void;
23
+ /**
24
+ * Reports whether this view has been destroyed.
25
+ * @returns True after the `destroy()` method has been called, false otherwise.
26
+ */
15
27
  abstract readonly destroyed: boolean;
28
+ /**
29
+ * A lifecycle hook that provides additional developer-defined cleanup
30
+ * functionality for views.
31
+ * @param callback A handler function that cleans up developer-defined data
32
+ * associated with a view. Called when the `destroy()` method is invoked.
33
+ */
16
34
  abstract onDestroy(callback: Function): any /** TODO #9100 */;
17
35
  }
18
36
  /**
19
- * Represents an Angular View.
37
+ * Represents an Angular [view](guide/glossary#view) in a view container.
38
+ * An [embedded view](guide/glossary#view-tree) can be referenced from a component
39
+ * other than the hosting component whose template defines it, or it can be defined
40
+ * independently by a `TemplateRef`.
20
41
  *
21
- * <!-- TODO: move the next two paragraphs to the dev guide -->
22
- * A View is a fundamental building block of the application UI. It is the smallest grouping of
23
- * Elements which are created and destroyed together.
42
+ * Properties of elements in a view can change, but the structure (number and order) of elements in
43
+ * a view cannot. Change the structure of elements by inserting, moving, or
44
+ * removing nested views in a view container.
24
45
  *
25
- * Properties of elements in a View can change, but the structure (number and order) of elements in
26
- * a View cannot. Changing the structure of Elements can only be done by inserting, moving or
27
- * removing nested Views via a `ViewContainerRef`. Each View can contain many View Containers.
28
- * <!-- /TODO -->
46
+ * @see `ViewContainerRef`
29
47
  *
30
48
  * @usageNotes
31
- * ### Example
32
49
  *
33
- * Given this template...
50
+ * The following template breaks down into two separate `TemplateRef` instances,
51
+ * an outer one and an inner one.
34
52
  *
35
53
  * ```
36
54
  * Count: {{items.length}}
@@ -39,9 +57,7 @@ export declare abstract class ViewRef extends ChangeDetectorRef {
39
57
  * </ul>
40
58
  * ```
41
59
  *
42
- * We have two `TemplateRef`s:
43
- *
44
- * Outer `TemplateRef`:
60
+ * This is the outer `TemplateRef`:
45
61
  *
46
62
  * ```
47
63
  * Count: {{items.length}}
@@ -50,15 +66,13 @@ export declare abstract class ViewRef extends ChangeDetectorRef {
50
66
  * </ul>
51
67
  * ```
52
68
  *
53
- * Inner `TemplateRef`:
69
+ * This is the inner `TemplateRef`:
54
70
  *
55
71
  * ```
56
72
  * <li>{{item}}</li>
57
73
  * ```
58
74
  *
59
- * Notice that the original template is broken down into two separate `TemplateRef`s.
60
- *
61
- * The outer/inner `TemplateRef`s are then assembled into views like so:
75
+ * The outer and inner `TemplateRef` instances are assembled into views as follows:
62
76
  *
63
77
  * ```
64
78
  * <!-- ViewRef: outer-0 -->
@@ -73,7 +87,13 @@ export declare abstract class ViewRef extends ChangeDetectorRef {
73
87
  * @experimental
74
88
  */
75
89
  export declare abstract class EmbeddedViewRef<C> extends ViewRef {
90
+ /**
91
+ * The context for this view, inherited from the anchor element.
92
+ */
76
93
  abstract readonly context: C;
94
+ /**
95
+ * The root nodes for this embedded view.
96
+ */
77
97
  abstract readonly rootNodes: any[];
78
98
  }
79
99
  export interface InternalViewRef extends ViewRef {
@@ -10,6 +10,9 @@
10
10
  *
11
11
  * See {@link Component#encapsulation encapsulation}.
12
12
  *
13
+ * @usageNotes
14
+ * ### Example
15
+ * {@example core/ts/metadata/encapsulation.ts region='longform'}
13
16
  */
14
17
  export declare enum ViewEncapsulation {
15
18
  /**
@@ -40,9 +43,6 @@ export declare enum ViewEncapsulation {
40
43
  * For the DOM this means using modern [Shadow
41
44
  * DOM](https://w3c.github.io/webcomponents/spec/shadow/) and
42
45
  * creating a ShadowRoot for Component's Host Element.
43
- *
44
- * ### Example
45
- * {@example core/ts/metadata/encapsulation.ts region='longform'}
46
46
  */
47
47
  ShadowDom = 3
48
48
  }
@@ -29,4 +29,4 @@ declare global {
29
29
  rendererRemoveNode: number;
30
30
  }
31
31
  }
32
- export declare const ngDevModeResetPerfCounters: () => void;
32
+ export declare function ngDevModeResetPerfCounters(): NgDevModePerfCounters;
package/src/zone.d.ts CHANGED
@@ -5,4 +5,4 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- export { NgZone } from './zone/ng_zone';
8
+ export { NgZone, NoopNgZone as ɵNoopNgZone } from './zone/ng_zone';