Ng-zorro-antd: Can't bind to 'nzData' since it isn't a known property of 'nz-tree'.

Created on 15 Oct 2018  路  4Comments  路  Source: NG-ZORRO/ng-zorro-antd

Having following dependencies.
"@angular/cli": "~6.1.1",
"typescript": "~2.7.2"
"ng-zorro-antd": "^1.4.0",

Used nz-tree component but didnt worked and giving error, attached in screenshot
2018-10-15_112812

In component.html

```
[nzData]="nodes"
nzCheckable="true"
nzMultiple="true"
[nzCheckedKeys]="defaultCheckedKeys"
[nzExpandedKeys]="defaultExpandedKeys"
[nzSelectedKeys]="defaultSelectedKeys"
(nzClick)="nzClick($event)"
(nzCheckBoxChange)="nzCheck($event)">

**In component.ts**

import { Component, Inject, OnInit, ViewChild } from '@angular/core';
import { NzFormatEmitEvent, NzTreeNode, NzTreeNodeOptions } from 'ng-zorro-antd';
export class Component implements OnInit {
@ViewChild('treeCom') treeCom;
defaultCheckedKeys = ['1001', '1002'];
defaultSelectedKeys = ['10011'];
defaultExpandedKeys = ['100', '1001'];

nodes: NzTreeNodeOptions[] = [{
title: 'parent 1',
key: '100',
children: [{
title: 'parent 1-0',
key: '1001',
disabled: true,
children: [
{ title: 'leaf 1-0-0', key: '10010', disableCheckbox: true, isLeaf: true },
{ title: 'leaf 1-0-1', key: '10011', isLeaf: true, checked: true }
]
}, {
title: 'parent 1-1',
key: '1002',
children: [
{ title: 'leaf 1-1-0', key: '10020', isLeaf: true }
]
}]
}];

nzClick(event: NzFormatEmitEvent): void {
console.log(event, event.selectedKeys, event.keys, event.nodes);
}

nzCheck(event: NzFormatEmitEvent): void {
console.log(event, event.checkedKeys, event.keys, event.nodes);
}

ngOnInit() {
setTimeout(() => {
console.log(this.treeCom.getTreeNodes(), this.treeCom.getCheckedNodeList());
}, 500);
}
}
```

Invalid

Most helpful comment

only 1.6.0+ version support nzData,upgrade your dependencies

All 4 comments

Hello @rahulmistry25425, your issue has been closed because it does not conform to our issue requirements. Please use the Issue Helper to create an issue, thank you!

only 1.6.0+ version support nzData,upgrade your dependencies

version 1.6.0 not work, but update to latest version work for me.

When updating doesn't work for you, please remove node_modules and reinstall all dependencies.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rafaelsmith picture rafaelsmith  路  3Comments

rahulmistry25425 picture rahulmistry25425  路  3Comments

vthinkxie picture vthinkxie  路  3Comments

ismezy picture ismezy  路  3Comments

Ximena-con picture Ximena-con  路  3Comments