* 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)
| 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 |
no test coverage detected