Reputation: 16309
The angular2-tree library has a straightforward Basic Usage example. However, when I put it into my project, only the root nodes are rendered. In other words, the tree should have parents (rootA, rootB) and children,
export class App {
nodes = [
{
id: 1,
name: 'rootA',
children: [
{ id: 2, name: 'child1' },
{ id: 3, name: 'child2' }
]
},
{
id: 4,
name: 'rootB',
children: [
{ id: 5, name: 'child2.1' },
{
id: 6,
name: 'child2.2',
children: [
{ id: 7, name: 'subsub' }
]
}
]
}
];
But all I see are root nodes.
There are no compilation issues, and I've included the css import:
@import '~angular-tree-component/dist/angular-tree-component.css';
Has anyone had a similar issue?
Stack is Angular 4, Chrome, Windows 10.
Upvotes: 2
Views: 1193
Reputation: 53
You need to copy the css content from node_modules\angular-tree-component\distangular-tree-component.css
and paste the contents on styles.css
file present under src
folder of your application.
Or alternatively you can also add this statement in the styles.css
file.
@import '~angular-tree-component/dist/angular-tree-component.css';
This will solve the problem.
Upvotes: 2