44
55This document explains the concept of a View.
66A View is a core primitive used by angular to render the DOM tree.
7- A ViewPort is location in a View which can accept child Views.
8- Every ViewPort has an associated ViewContainerRef than can contain any number of child Views.
7+ A ViewContainer is location in a View which can accept child Views.
8+ Every ViewContainer has an associated ViewContainerRef than can contain any number of child Views.
99Views form a tree structure which mimics the DOM tree.
1010
1111* View is a core rendering construct. A running application is just a collection of Views which are
@@ -15,7 +15,7 @@ Views form a tree structure which mimics the DOM tree.
1515* Views represent a running instance of a DOM View. This implies that while elements in a View
1616 can change properties, they can not change structurally. (Structural changes such as, adding or
1717 removing elements requires adding or removing child Views into ViewContainers).
18- * View can have zero or more ViewPorts . A ViewPort is a marker in the DOM which allows
18+ * View can have zero or more ViewContainers . A ViewContainer is a marker in the DOM which allows
1919 the insertion of child Views.
2020* Views are created from a ProtoView. A ProtoView is a compiled DOM View which is efficient at
2121 creating Views.
8888## Composed View
8989
9090An important part of an application is to be able to change the DOM structure to render data for the
91- user. In Angular this is done by inserting child views into the ViewPort .
91+ user. In Angular this is done by inserting child views into the ViewContainer .
9292
9393Let's start with a View such as:
9494
108108
109109```
110110<ul> | protoViewA(someContext)
111- <template></template> | protoViewA(someContext): new ProtoViewPort( protoViewB)
111+ <template></template> | protoViewA(someContext): protoViewB
112112</ul> | protoViewA(someContext)
113113```
114114
@@ -119,7 +119,7 @@ The next step is to compose these two ProtoViews into an actual view which is re
119119
120120```
121121<ul> | viewA(someContext)
122- <template></template> | viewA(someContext): new Foreach(new ViewPort (protoViewB))
122+ <template></template> | viewA(someContext): new Foreach(new ViewContainer (protoViewB))
123123</ul> | viewA(someContext)
124124```
125125
@@ -128,11 +128,11 @@ has a reference to `protoViewA`).
128128
129129
130130* Step3:* As the ` Foreach ` directive unrolls it asks the ` ViewContainerRef ` to instantiate ` protoViewB ` and insert
131- it after the ` ViewPort ` anchor. This is repeated for each ` person ` in ` people ` . Notice that
131+ it after the ` ViewContainer ` anchor. This is repeated for each ` person ` in ` people ` . Notice that
132132
133133```
134134<ul> | viewA(someContext)
135- <template></template> | viewA(someContext): new Foreach(new ViewPort (protoViewB))
135+ <template></template> | viewA(someContext): new Foreach(new ViewContainer (protoViewB))
136136 <li>{{person}}</li> | viewB0(locals0(someContext))
137137 <li>{{person}}</li> | viewB1(locals0(someContext))
138138</ul> | viewA(someContext)
@@ -145,13 +145,13 @@ delegate any unknown references to the parent context.
145145
146146```
147147<ul> | viewA
148- <template></template> | viewA: new Foreach(new ViewPort (protoViewB))
148+ <template></template> | viewA: new Foreach(new ViewContainer (protoViewB))
149149 <li>Alice</li> | viewB0
150150 <li>Bob</li> | viewB1
151151</ul> | viewA
152152```
153153
154- Each View can have zero or more ViewPorts . By inserting and removing child Views to and from the
154+ Each View can have zero or more ViewContainers . By inserting and removing child Views to and from the
155155ViewContainers, the application can mutate the DOM structure to any desirable state. A View may contain
156156individual nodes or a complex DOM structure. The insertion points for the child Views, known as
157157ViewContainers, contain a DOM element which acts as an anchor. The anchor is either a ` template ` or
@@ -161,7 +161,7 @@ inserted.
161161## Component Views
162162
163163A View can also contain Components. Components contain Shadow DOM for encapsulating their internal
164- rendering state. Unlike ViewPorts which can contain zero or more Views, the Component always contains
164+ rendering state. Unlike ViewContainers which can contain zero or more Views, the Component always contains
165165exactly one Shadow View.
166166
167167```
0 commit comments