1
|
/**
|
2
|
* @license
|
3
|
* Copyright Google Inc. All Rights Reserved.
|
4
|
*
|
5
|
* Use of this source code is governed by an MIT-style license that can be
|
6
|
* found in the LICENSE file at https://angular.io/license
|
7
|
*/
|
8
|
import { ApplicationRef } from '../application_ref';
|
9
|
import { ChangeDetectorRef } from '../change_detection/change_detector_ref';
|
10
|
/**
|
11
|
* @stable
|
12
|
*/
|
13
|
export declare abstract class ViewRef extends ChangeDetectorRef {
|
14
|
/**
|
15
|
* Destroys the view and all of the data structures associated with it.
|
16
|
*/
|
17
|
abstract destroy(): void;
|
18
|
readonly abstract destroyed: boolean;
|
19
|
abstract onDestroy(callback: Function): any;
|
20
|
}
|
21
|
/**
|
22
|
* Represents an Angular View.
|
23
|
*
|
24
|
* <!-- TODO: move the next two paragraphs to the dev guide -->
|
25
|
* A View is a fundamental building block of the application UI. It is the smallest grouping of
|
26
|
* Elements which are created and destroyed together.
|
27
|
*
|
28
|
* Properties of elements in a View can change, but the structure (number and order) of elements in
|
29
|
* a View cannot. Changing the structure of Elements can only be done by inserting, moving or
|
30
|
* removing nested Views via a {@link ViewContainerRef}. Each View can contain many View Containers.
|
31
|
* <!-- /TODO -->
|
32
|
*
|
33
|
* ### Example
|
34
|
*
|
35
|
* Given this template...
|
36
|
*
|
37
|
* ```
|
38
|
* Count: {{items.length}}
|
39
|
* <ul>
|
40
|
* <li *ngFor="let item of items">{{item}}</li>
|
41
|
* </ul>
|
42
|
* ```
|
43
|
*
|
44
|
* We have two {@link TemplateRef}s:
|
45
|
*
|
46
|
* Outer {@link TemplateRef}:
|
47
|
* ```
|
48
|
* Count: {{items.length}}
|
49
|
* <ul>
|
50
|
* <ng-template ngFor let-item [ngForOf]="items"></ng-template>
|
51
|
* </ul>
|
52
|
* ```
|
53
|
*
|
54
|
* Inner {@link TemplateRef}:
|
55
|
* ```
|
56
|
* <li>{{item}}</li>
|
57
|
* ```
|
58
|
*
|
59
|
* Notice that the original template is broken down into two separate {@link TemplateRef}s.
|
60
|
*
|
61
|
* The outer/inner {@link TemplateRef}s are then assembled into views like so:
|
62
|
*
|
63
|
* ```
|
64
|
* <!-- ViewRef: outer-0 -->
|
65
|
* Count: 2
|
66
|
* <ul>
|
67
|
* <ng-template view-container-ref></ng-template>
|
68
|
* <!-- ViewRef: inner-1 --><li>first</li><!-- /ViewRef: inner-1 -->
|
69
|
* <!-- ViewRef: inner-2 --><li>second</li><!-- /ViewRef: inner-2 -->
|
70
|
* </ul>
|
71
|
* <!-- /ViewRef: outer-0 -->
|
72
|
* ```
|
73
|
* @experimental
|
74
|
*/
|
75
|
export declare abstract class EmbeddedViewRef<C> extends ViewRef {
|
76
|
readonly abstract context: C;
|
77
|
readonly abstract rootNodes: any[];
|
78
|
}
|
79
|
export interface InternalViewRef extends ViewRef {
|
80
|
detachFromAppRef(): void;
|
81
|
attachToAppRef(appRef: ApplicationRef): void;
|
82
|
}
|