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

Function createSpecialToken

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

Source from the content-addressed store, hash-verified

362}
363
364function createSpecialToken(lView: LView, tNode: TNode, read: any): any {
365 if (read === ViewEngine_ElementRef) {
366 return createElementRef(tNode, lView);
367 } else if (read === ViewEngine_TemplateRef) {
368 return createTemplateRef(tNode, lView);
369 } else if (read === ViewContainerRef) {
370 ngDevMode && assertTNodeType(tNode, TNodeType.AnyRNode | TNodeType.AnyContainer);
371 return createContainerRef(
372 tNode as TElementNode | TContainerNode | TElementContainerNode,
373 lView,
374 );
375 } else if (read === Injector) {
376 return new NodeInjector(tNode as TElementNode | TContainerNode | TElementContainerNode, lView);
377 } else {
378 ngDevMode &&
379 throwError(
380 `Special token to read should be one of ElementRef, TemplateRef, ViewContainerRef or Injector but got ${stringify(
381 read,
382 )}.`,
383 );
384 }
385}
386
387/**
388 * 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