( index: number, templateFn: ComponentTemplate<unknown>, decls: number, vars: number, tagName: string | null, attrsIndex: number | null, trackByFn: TrackByFunction<unknown>, trackByUsesComponentInstance?: boolean, emptyTemplateFn?: ComponentTemplate<unknown>, emptyDecls?: number, emptyVars?: number, emptyTagName?: string | null, emptyAttrsIndex?: number | null, )
| 288 | * @codeGenApi |
| 289 | */ |
| 290 | export function ɵɵrepeaterCreate( |
| 291 | index: number, |
| 292 | templateFn: ComponentTemplate<unknown>, |
| 293 | decls: number, |
| 294 | vars: number, |
| 295 | tagName: string | null, |
| 296 | attrsIndex: number | null, |
| 297 | trackByFn: TrackByFunction<unknown>, |
| 298 | trackByUsesComponentInstance?: boolean, |
| 299 | emptyTemplateFn?: ComponentTemplate<unknown>, |
| 300 | emptyDecls?: number, |
| 301 | emptyVars?: number, |
| 302 | emptyTagName?: string | null, |
| 303 | emptyAttrsIndex?: number | null, |
| 304 | ): void { |
| 305 | performanceMarkFeature('NgControlFlow'); |
| 306 | |
| 307 | ngDevMode && |
| 308 | assertFunction( |
| 309 | trackByFn, |
| 310 | `A track expression must be a function, was ${typeof trackByFn} instead.`, |
| 311 | ); |
| 312 | |
| 313 | const lView = getLView(); |
| 314 | const tView = getTView(); |
| 315 | const hasEmptyBlock = emptyTemplateFn !== undefined; |
| 316 | const hostLView = getLView(); |
| 317 | const boundTrackBy = trackByUsesComponentInstance |
| 318 | ? // We only want to bind when necessary, because it produces a |
| 319 | // new function. For pure functions it's not necessary. |
| 320 | trackByFn.bind(hostLView[DECLARATION_COMPONENT_VIEW][CONTEXT]) |
| 321 | : trackByFn; |
| 322 | const metadata = new RepeaterMetadata(hasEmptyBlock, boundTrackBy); |
| 323 | hostLView[HEADER_OFFSET + index] = metadata; |
| 324 | |
| 325 | declareNoDirectiveHostTemplate( |
| 326 | lView, |
| 327 | tView, |
| 328 | index + 1, |
| 329 | templateFn, |
| 330 | decls, |
| 331 | vars, |
| 332 | tagName, |
| 333 | getConstant(tView.consts, attrsIndex), |
| 334 | TNodeFlags.isControlFlowStart, |
| 335 | ); |
| 336 | |
| 337 | if (hasEmptyBlock) { |
| 338 | ngDevMode && |
| 339 | assertDefined(emptyDecls, 'Missing number of declarations for the empty repeater block.'); |
| 340 | ngDevMode && |
| 341 | assertDefined(emptyVars, 'Missing number of bindings for the empty repeater block.'); |
| 342 | |
| 343 | declareNoDirectiveHostTemplate( |
| 344 | lView, |
| 345 | tView, |
| 346 | index + 2, |
| 347 | emptyTemplateFn, |
nothing calls this directly
no test coverage detected
searching dependent graphs…