Description
Reproduction
Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/angular-de5mhj
Steps to reproduce:
- Create a cdk-tree
- set the value of cdkTreeNodePadding to "0" for the cdk-tree-node
<cdk-tree-node *cdkTreeNodeDef="let node" cdkTreeNodePadding="0">
Expected Behavior
What behavior were you expecting to see?
cdkTreeNodePadding should honor the level that is passed as its value. When the passed level is '0', the padding for the cdkTreeNode should be set to 0 * indent pixels
.
This line contains a comparison that causes the issue when the level is set to '0'
components/src/cdk/tree/padding.ts
Line 93 in 6a7fc81
Instead, it should check if this._level
is explicitly undefined or null.
const level = (this._level === null || this._level === undefined) || nodeLevel;
Actual Behavior
What behavior did you actually see?
The passed level ('0') is ignored and the padding is set to level * indent pixels
. All values other than '0' work fine.
Environment
- Angular: 8.0.1
- CDK/Material: 8.0.1
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS