Sruthish
Sruthish

Reputation: 53

Module not found: Error: Can't resolve '@angular/cdk/tree' '@angular/material/tree'

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

Upvotes: 1

Views: 6806

Answers (1)

G. Tranter
G. Tranter

Reputation: 17958

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.

Upvotes: 1

Related Questions