1
votes

I'm using Angular 5 and trying to achieve a tree view like this with a table like display.

https://stackblitz.com/edit/angular-hhkrr1?file=main.ts

when I try to import

import {NestedTreeControl} from '@angular/cdk/tree'; import {MatTreeNestedDataSource} from '@angular/material/tree';

I'm getting error

ERROR in ./src/app/app.module.ts Module not found: Error: Can't resolve '@angular/cdk/tree' in 'XXX' ERROR in ./src/app/AgileBOM/agile-bom.tabs.component.ts Module not found: Error: Can't resolve '@angular/cdk/tree' in 'XXX' ERROR in ./src/app/AgileBOM/agile-bom.tabs.component.ts Module not found: Error: Can't resolve '@angular/material/tree' in 'XXX'

I tried "npm install" - Didn't work also tried to install angular material & cdk but in vain.

What could be the issue

1
It seems like @angular/cdk/tree(introduced from @angular/material 6+ version) package is missing, the reason could be you have to download @angular/material & @angular/cdk latest version (6.x.x) - Pankaj Parkar
I tried installing the latest, then I'm getting error for existing material module.. - Sruthish

1 Answers

1
votes

The Tree component is new in Angular Material 6 which requires Angular 6. You would need to upgrade your application's various Angular dependencies from 5.x in order to use the Tree component.