MCPcopy Index your code
hub / github.com/angular/components / _updateRowIndexContext

Method _updateRowIndexContext

src/cdk/table/table.ts:1390–1408  ·  view source on GitHub ↗

* Updates the index-related context for each row to reflect any changes in the index of the rows, * e.g. first/last/even/odd.

()

Source from the content-addressed store, hash-verified

1388 * e.g. first/last/even/odd.
1389 */
1390 private _updateRowIndexContext() {
1391 const viewContainer = this._rowOutlet.viewContainer;
1392 for (let renderIndex = 0, count = viewContainer.length; renderIndex < count; renderIndex++) {
1393 const viewRef = viewContainer.get(renderIndex) as RowViewRef<T>;
1394 const context = viewRef.context as RowContext<T>;
1395 context.count = count;
1396 context.first = renderIndex === 0;
1397 context.last = renderIndex === count - 1;
1398 context.even = renderIndex % 2 === 0;
1399 context.odd = !context.even;
1400
1401 if (this.multiTemplateDataRows) {
1402 context.dataIndex = this._renderRows[renderIndex].dataIndex;
1403 context.renderIndex = renderIndex;
1404 } else {
1405 context.index = this._renderRows[renderIndex].dataIndex;
1406 }
1407 }
1408 }
1409
1410 /** Gets the column definitions for the provided row def. */
1411 private _getCellTemplates(rowDef: BaseRowDef): TemplateRef<any>[] {

Callers 1

renderRowsMethod · 0.95

Calls 1

getMethod · 0.65

Tested by

no test coverage detected