问题描述: 在Angular 16上,Ngx-org-chart无法正常工作。
解决方法:
npm install ngx-org-chart --save
app.module.ts
文件中引入了NgxOrgChartModule:import { NgxOrgChartModule } from 'ngx-org-chart';
@NgModule({
imports: [
// ...
NgxOrgChartModule
],
// ...
})
export class AppModule { }
export class MyComponent {
chartData = [
{
id: 1,
name: 'John Doe',
children: [
{
id: 2,
name: 'Jane Smith',
children: [
{
id: 3,
name: 'Sammy Doe',
children: []
}
]
}
]
}
];
}
确保根据需要调整chartData变量以适应您的数据结构。
以上是解决在Angular 16上使用Ngx-org-chart无法正常工作的方法。请注意,确保使用最新版本的Ngx-org-chart和Angular,并根据需要调整代码以适应您的项目。