MCPcopy
hub / github.com/angular/angular / createSpecialToken

Function createSpecialToken

packages/core/src/render3/queries/query.ts:362–381  ·  view source on GitHub ↗
(lView: LView, tNode: TNode, read: any)

Source from the content-addressed store, hash-verified

360}
361
362function createSpecialToken(lView: LView, tNode: TNode, read: any): any {
363 if (read === ViewEngine_ElementRef) {
364 return createElementRef(tNode, lView);
365 } else if (read === ViewEngine_TemplateRef) {
366 return createTemplateRef(tNode, lView);
367 } else if (read === ViewContainerRef) {
368 ngDevMode && assertTNodeType(tNode, TNodeType.AnyRNode | TNodeType.AnyContainer);
369 return createContainerRef(
370 tNode as TElementNode | TContainerNode | TElementContainerNode,
371 lView,
372 );
373 } else {
374 ngDevMode &&
375 throwError(
376 `Special token to read should be one of ElementRef, TemplateRef or ViewContainerRef but got ${stringify(
377 read,
378 )}.`,
379 );
380 }
381}
382
383/**
384 * A helper function that creates query results for a given view. This function is meant to do the

Callers 1

createResultForNodeFunction · 0.85

Calls 6

createElementRefFunction · 0.90
createTemplateRefFunction · 0.90
assertTNodeTypeFunction · 0.90
createContainerRefFunction · 0.90
throwErrorFunction · 0.90
stringifyFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…