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

Method isLeafNode

src/cdk/tree/tree.ts:1316–1333  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1314
1315 /* If leaf node, return true to not assign aria-expanded attribute */
1316 get isLeafNode(): boolean {
1317 // If flat tree node data returns false for expandable property, it's a leaf node
1318 if (
1319 this._tree.treeControl?.isExpandable !== undefined &&
1320 !this._tree.treeControl.isExpandable(this._data)
1321 ) {
1322 return true;
1323
1324 // If nested tree node data returns 0 descendants, it's a leaf node
1325 } else if (
1326 this._tree.treeControl?.isExpandable === undefined &&
1327 this._tree.treeControl?.getDescendants(this._data).length === 0
1328 ) {
1329 return true;
1330 }
1331
1332 return false;
1333 }
1334
1335 get level(): number {
1336 // If the tree has a levelAccessor, use it to get the level. Otherwise read the

Callers

nothing calls this directly

Calls 2

getDescendantsMethod · 0.65
isExpandableMethod · 0.45

Tested by

no test coverage detected