@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.
- package/bundles/core-testing.umd.js +23 -16
- package/bundles/core-testing.umd.js.map +1 -1
- package/bundles/core-testing.umd.min.js +6 -6
- package/bundles/core-testing.umd.min.js.map +1 -1
- package/bundles/core.umd.js +166 -139
- package/bundles/core.umd.js.map +1 -1
- package/bundles/core.umd.min.js +81 -81
- package/bundles/core.umd.min.js.map +1 -1
- package/core.metadata.json +1 -1
- package/esm2015/index.js +2 -2
- package/esm2015/public_api.js +2 -2
- package/esm2015/src/application_module.js +11 -4
- package/esm2015/src/change_detection/change_detector_ref.js +2 -2
- package/esm2015/src/core.js +2 -2
- package/esm2015/src/di/injection_token.js +3 -3
- package/esm2015/src/di/reflective_injector.js +1 -10
- package/esm2015/src/linker/component_factory.js +19 -16
- package/esm2015/src/linker/template_ref.js +20 -14
- package/esm2015/src/linker/view_container_ref.js +61 -68
- package/esm2015/src/linker/view_ref.js +29 -21
- package/esm2015/src/metadata/view.js +1 -4
- package/esm2015/src/render3/instructions.js +2 -2
- package/esm2015/src/render3/ng_dev_mode.js +52 -31
- package/esm2015/src/version.js +1 -1
- package/esm2015/src/zone.js +2 -2
- package/esm5/src/application_init.js +7 -8
- package/esm5/src/application_module.js +16 -10
- package/esm5/src/application_ref.js +15 -21
- package/esm5/src/change_detection/change_detector_ref.js +2 -2
- package/esm5/src/console.js +5 -4
- package/esm5/src/di/injection_token.js +3 -3
- package/esm5/src/di/reflective_injector.js +1 -1
- package/esm5/src/linker/compiler.js +5 -4
- package/esm5/src/linker/component_factory.js +4 -6
- package/esm5/src/linker/system_js_ng_module_factory_loader.js +6 -9
- package/esm5/src/linker/template_ref.js +13 -8
- package/esm5/src/linker/view_container_ref.js +9 -13
- package/esm5/src/linker/view_ref.js +22 -18
- package/esm5/src/metadata/view.js +4 -4
- package/esm5/src/render3/instructions.js +2 -2
- package/esm5/src/render3/ng_dev_mode.js +48 -27
- package/esm5/src/testability/testability.js +10 -13
- package/esm5/src/version.js +1 -1
- package/esm5/src/zone.js +2 -2
- package/esm5/testing/src/logger.js +6 -6
- package/esm5/testing/src/ng_zone_mock.js +5 -6
- package/esm5/testing/src/test_bed.js +13 -13
- package/esm5/testing/src/test_compiler.js +4 -4
- package/fesm2015/core.js +110 -84
- package/fesm2015/core.js.map +1 -1
- package/fesm2015/testing.js +1 -1
- package/fesm5/core.js +155 -141
- package/fesm5/core.js.map +1 -1
- package/fesm5/testing.js +17 -17
- package/fesm5/testing.js.map +1 -1
- package/package.json +1 -1
- package/src/application_module.d.ts +10 -2
- package/src/change_detection/change_detector_ref.d.ts +1 -1
- package/src/di/injection_token.d.ts +2 -2
- package/src/di/reflective_injector.d.ts +0 -9
- package/src/linker/component_factory.d.ts +22 -14
- package/src/linker/template_ref.d.ts +21 -11
- package/src/linker/view_container_ref.d.ts +61 -44
- package/src/linker/view_ref.d.ts +38 -18
- package/src/metadata/view.d.ts +3 -3
- package/src/render3/ng_dev_mode.d.ts +1 -1
- 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
|
|
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
|
-
*
|
|
14
|
-
* (or directive prefixed with `*`)
|
|
15
|
-
* the constructor of the directive
|
|
16
|
-
* the `TemplateRef`
|
|
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
|
-
*
|
|
19
|
-
*
|
|
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
|
|
29
|
+
* The anchor element in the parent view for this embedded view.
|
|
25
30
|
*
|
|
26
|
-
* The data-binding and injection contexts of
|
|
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
|
|
30
|
-
* advanced use-cases, 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
|
|
15
|
+
* Represents a container where one or more views can be attached to a component.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
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
|
-
*
|
|
22
|
-
*
|
|
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
|
-
*
|
|
26
|
-
*
|
|
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
|
|
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
|
|
49
|
+
* Destroys all views in this container.
|
|
42
50
|
*/
|
|
43
51
|
abstract clear(): void;
|
|
44
52
|
/**
|
|
45
|
-
*
|
|
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
|
-
*
|
|
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
|
|
54
|
-
* into this container
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
|
77
|
-
*
|
|
78
|
-
*
|
|
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
|
|
85
|
-
*
|
|
86
|
-
*
|
|
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
|
|
91
|
-
*
|
|
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
|
|
96
|
-
*
|
|
97
|
-
* If
|
|
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
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
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
|
}
|
package/src/linker/view_ref.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
69
|
+
* This is the inner `TemplateRef`:
|
|
54
70
|
*
|
|
55
71
|
* ```
|
|
56
72
|
* <li>{{item}}</li>
|
|
57
73
|
* ```
|
|
58
74
|
*
|
|
59
|
-
*
|
|
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 {
|
package/src/metadata/view.d.ts
CHANGED
|
@@ -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
|
}
|
package/src/zone.d.ts
CHANGED