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

Method _getNodeDef

src/cdk/tree/tree.ts:576–589  ·  view source on GitHub ↗

* Finds the matching node definition that should be used for this node data. If there is only * one node definition, it is returned. Otherwise, find the node definition that has a when * predicate that returns true with the data. If none return true, return the default node * definition.

(data: T, i: number)

Source from the content-addressed store, hash-verified

574 * definition.
575 */
576 _getNodeDef(data: T, i: number): CdkTreeNodeDef<T> {
577 if (this._nodeDefs.length === 1) {
578 return this._nodeDefs.first!;
579 }
580
581 const nodeDef =
582 this._nodeDefs.find(def => def.when && def.when(i, data)) || this._defaultNodeDef;
583
584 if (!nodeDef && (typeof ngDevMode === 'undefined' || ngDevMode)) {
585 throw getTreeMissingMatchingNodeDefError();
586 }
587
588 return nodeDef!;
589 }
590
591 /**
592 * Create the embedded view for the data node template and place it in the correct index location

Callers 1

insertNodeMethod · 0.95

Calls 1

Tested by

no test coverage detected