MCPcopy Create free account
hub / github.com/angular/angular / matchTNode

Method matchTNode

packages/core/src/render3/queries/query.ts:256–282  ·  view source on GitHub ↗
(tView: TView, tNode: TNode)

Source from the content-addressed store, hash-verified

254 }
255
256 private matchTNode(tView: TView, tNode: TNode): void {
257 const predicate = this.metadata.predicate;
258 if (Array.isArray(predicate)) {
259 for (let i = 0; i < predicate.length; i++) {
260 const name = predicate[i];
261 this.matchTNodeWithReadOption(tView, tNode, getIdxOfMatchingSelector(tNode, name));
262 // Also try matching the name to a provider since strings can be used as DI tokens too.
263 this.matchTNodeWithReadOption(
264 tView,
265 tNode,
266 locateDirectiveOrProvider(tNode, tView, name, false, false),
267 );
268 }
269 } else {
270 if ((predicate as any) === ViewEngine_TemplateRef) {
271 if (tNode.type & TNodeType.Container) {
272 this.matchTNodeWithReadOption(tView, tNode, -1);
273 }
274 } else {
275 this.matchTNodeWithReadOption(
276 tView,
277 tNode,
278 locateDirectiveOrProvider(tNode, tView, predicate, false, false),
279 );
280 }
281 }
282 }
283
284 private matchTNodeWithReadOption(tView: TView, tNode: TNode, nodeMatchIdx: number | null): void {
285 if (nodeMatchIdx !== null) {

Callers 1

elementStartMethod · 0.95

Calls 4

getIdxOfMatchingSelectorFunction · 0.85
isArrayMethod · 0.80

Tested by

no test coverage detected