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

Function getTemplateIndexForState

packages/core/src/defer/utils.ts:73–94  ·  view source on GitHub ↗
(
  newState: DeferBlockState,
  hostLView: LView,
  tNode: TNode,
)

Source from the content-addressed store, hash-verified

71}
72
73export function getTemplateIndexForState(
74 newState: DeferBlockState,
75 hostLView: LView,
76 tNode: TNode,
77): number | null {
78 const tView = hostLView[TVIEW];
79 const tDetails = getTDeferBlockDetails(tView, tNode);
80
81 switch (newState) {
82 case DeferBlockState.Complete:
83 return tDetails.primaryTmplIndex;
84 case DeferBlockState.Loading:
85 return tDetails.loadingTmplIndex;
86 case DeferBlockState.Error:
87 return tDetails.errorTmplIndex;
88 case DeferBlockState.Placeholder:
89 return tDetails.placeholderTmplIndex;
90 default:
91 ngDevMode && throwError(`Unexpected defer block state: ${newState}`);
92 return null;
93 }
94}
95
96/**
97 * Returns a minimum amount of time that a given state should be rendered for,

Callers 1

applyDeferBlockStateFunction · 0.90

Calls 2

throwErrorFunction · 0.90
getTDeferBlockDetailsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…