Home > OS >  error TS2307: Cannot find module './portfolio/portfolio.component' or its corresponding ty
error TS2307: Cannot find module './portfolio/portfolio.component' or its corresponding ty

Time:01-02

In the folder -> dashboard > administration, I added a views folder for the component portfolio. My problem is that now I have an error message:

src/app/dashboard/administration/administration-routing.module.ts:5:36 
- error TS2307: Cannot find module './portfolio/portfolio.component' or its corresponding type declarations.

5 import { PortfolioComponent } from './portfolio/portfolio.component';

enter image description here

By going on the administration-routing.module.ts, I added the following path ./views but doesn't work ? I don't understand why ?

 {
    path: './views/portfolio',
    component: PortfolioComponent,
  },

The content of the Portfolio page doesn't appear. I changed the path, I don't understand why it is not working?

https://stackblitz.com/edit/github-goukxg?file=src/app/dashboard/administration/administration-routing.module.ts

CodePudding user response:

You just have missed 'views' in your import:

import { PortfolioComponent } from './views/portfolio/portfolio.component';

CodePudding user response:

in administration-routing.module.ts
change path: './views/portfolio'
to path: 'views/portfolio'

  • Related