MCPcopy
hub / github.com/angular/angular / TQueries_

Class TQueries_

packages/core/src/render3/queries/query.ts:110–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110class TQueries_ implements TQueries {
111 constructor(private queries: TQuery[] = []) {}
112
113 elementStart(tView: TView, tNode: TNode): void {
114 ngDevMode &&
115 assertFirstCreatePass(
116 tView,
117 'Queries should collect results on the first template pass only',
118 );
119 for (let i = 0; i < this.queries.length; i++) {
120 this.queries[i].elementStart(tView, tNode);
121 }
122 }
123 elementEnd(tNode: TNode): void {
124 for (let i = 0; i < this.queries.length; i++) {
125 this.queries[i].elementEnd(tNode);
126 }
127 }
128 embeddedTView(tNode: TNode): TQueries | null {
129 let queriesForTemplateRef: TQuery[] | null = null;
130
131 for (let i = 0; i < this.length; i++) {
132 const childQueryIndex = queriesForTemplateRef !== null ? queriesForTemplateRef.length : 0;
133 const tqueryClone = this.getByIndex(i).embeddedTView(tNode, childQueryIndex);
134
135 if (tqueryClone) {
136 tqueryClone.indexInDeclarationView = i;
137 if (queriesForTemplateRef !== null) {
138 queriesForTemplateRef.push(tqueryClone);
139 } else {
140 queriesForTemplateRef = [tqueryClone];
141 }
142 }
143 }
144
145 return queriesForTemplateRef !== null ? new TQueries_(queriesForTemplateRef) : null;
146 }
147
148 template(tView: TView, tNode: TNode): void {
149 ngDevMode &&
150 assertFirstCreatePass(
151 tView,
152 'Queries should collect results on the first template pass only',
153 );
154 for (let i = 0; i < this.queries.length; i++) {
155 this.queries[i].template(tView, tNode);
156 }
157 }
158
159 getByIndex(index: number): TQuery {
160 ngDevMode && assertIndexInRange(this.queries, index);
161 return this.queries[index];
162 }
163
164 get length(): number {
165 return this.queries.length;
166 }
167

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…