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

Method isApplyingToNode

packages/core/src/render3/queries/query.ts:226–253  ·  view source on GitHub ↗
(tNode: TNode)

Source from the content-addressed store, hash-verified

224 }
225
226 private isApplyingToNode(tNode: TNode): boolean {
227 if (
228 this._appliesToNextNode &&
229 (this.metadata.flags & QueryFlags.descendants) !== QueryFlags.descendants
230 ) {
231 const declarationNodeIdx = this._declarationNodeIndex;
232 let parent = tNode.parent;
233 // Determine if a given TNode is a "direct" child of a node on which a content query was
234 // declared (only direct children of query's host node can match with the descendants: false
235 // option). There are 3 main use-case / conditions to consider here:
236 // - <needs-target><i #target></i></needs-target>: here <i #target> parent node is a query
237 // host node;
238 // - <needs-target><ng-template [ngIf]="true"><i #target></i></ng-template></needs-target>:
239 // here <i #target> parent node is null;
240 // - <needs-target><ng-container><i #target></i></ng-container></needs-target>: here we need
241 // to go past `<ng-container>` to determine <i #target> parent node (but we shouldn't traverse
242 // up past the query's host node!).
243 while (
244 parent !== null &&
245 parent.type & TNodeType.ElementContainer &&
246 parent.index !== declarationNodeIdx
247 ) {
248 parent = parent.parent;
249 }
250 return declarationNodeIdx === (parent !== null ? parent.index : -1);
251 }
252 return this._appliesToNextNode;
253 }
254
255 private matchTNode(tView: TView, tNode: TNode): void {
256 const predicate = this.metadata.predicate;

Callers 2

elementStartMethod · 0.95
embeddedTViewMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected