MCPcopy Index your code
hub / github.com/angular/angular / createTView

Function createTView

packages/core/src/render3/view/construction.ts:67–127  ·  view source on GitHub ↗
(
  type: TViewType,
  declTNode: TNode | null,
  templateFn: ComponentTemplate<any> | null,
  decls: number,
  vars: number,
  directives: DirectiveDefListOrFactory | null,
  pipes: PipeDefListOrFactory | null,
  viewQuery: ViewQueriesFunction<any> | null,
  schemas: SchemaMetadata[] | null,
  constsOrFactory: TConstantsOrFactory | null,
  ssrId: string | null,
)

Source from the content-addressed store, hash-verified

65 * @param consts Constants for this view
66 */
67export function createTView(
68 type: TViewType,
69 declTNode: TNode | null,
70 templateFn: ComponentTemplate<any> | null,
71 decls: number,
72 vars: number,
73 directives: DirectiveDefListOrFactory | null,
74 pipes: PipeDefListOrFactory | null,
75 viewQuery: ViewQueriesFunction<any> | null,
76 schemas: SchemaMetadata[] | null,
77 constsOrFactory: TConstantsOrFactory | null,
78 ssrId: string | null,
79): TView {
80 const bindingStartIndex = HEADER_OFFSET + decls;
81 // This length does not yet contain host bindings from child directives because at this point,
82 // we don't know which directives are active on this template. As soon as a directive is matched
83 // that has a host binding, we will update the blueprint with that def's hostVars count.
84 const initialViewLength = bindingStartIndex + vars;
85 const blueprint = createViewBlueprint(bindingStartIndex, initialViewLength);
86 const consts = typeof constsOrFactory === 'function' ? constsOrFactory() : constsOrFactory;
87 const tView = (blueprint[TVIEW as any] = {
88 type: type,
89 blueprint: blueprint,
90 template: templateFn,
91 queries: null,
92 viewQuery: viewQuery,
93 declTNode: declTNode,
94 data: blueprint.slice().fill(null, bindingStartIndex),
95 bindingStartIndex: bindingStartIndex,
96 expandoStartIndex: initialViewLength,
97 hostBindingOpCodes: null,
98 firstCreatePass: true,
99 firstUpdatePass: true,
100 staticViewQueries: false,
101 staticContentQueries: false,
102 preOrderHooks: null,
103 preOrderCheckHooks: null,
104 contentHooks: null,
105 contentCheckHooks: null,
106 viewHooks: null,
107 viewCheckHooks: null,
108 destroyHooks: null,
109 cleanup: null,
110 contentQueries: null,
111 components: null,
112 directiveRegistry: typeof directives === 'function' ? directives() : directives,
113 pipeRegistry: typeof pipes === 'function' ? pipes() : pipes,
114 firstChild: null,
115 schemas: schemas,
116 consts: consts,
117 incompleteFirstPass: false,
118 ssrId,
119 });
120 if (ngDevMode) {
121 // For performance reasons it is important that the tView retains the same shape during runtime.
122 // (To make sure that all of the code is monomorphic.) For this reason we seal the object to
123 // prevent class transitions.
124 Object.seal(tView);

Callers 7

constructorMethod · 0.90
di_spec.tsFile · 0.90
matchers_spec.tsFile · 0.90
enterViewWithOneDivFunction · 0.90
createRootTViewFunction · 0.90
templateCreateFunction · 0.90

Calls 1

createViewBlueprintFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…