Angular 7 "Cannot find module"

Viewed 5289

I am trying to build an angular 7 app and I'm not very familiar with it. Can someone help me understand why it can't find the component.ts files? They exist in the paths the routing module references. I am getting the following error

enter image description here

Here are my components: app-routing.module.ts

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { ResumeComponent }      from './app/resume/resume.component';
import { HomeComponent }      from './app/home/home.component';
const routes: Routes = [
  { path: 'resume', component: ResumeComponent },
  { path: 'home', component: HomeComponent },
  { path: '',   redirectTo: '/home', pathMatch: 'full' }
];
@NgModule({
declarations: [
  HomeComponent,
  ResumeComponent
],
imports: [
 RouterModule.forRoot(routes)
],
exports: [
   RouterModule
]
})
export class AppRoutingModule { }

Home.Component

 import { Component, OnInit } from '@angular/core';

@Component({
 selector: 'app-home',
 templateUrl: './home.component.html',
 styleUrls: ['./home.component.css']
})
export class HomeComponent {

}   

Resume Component

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-resume',
  templateUrl: './resume.component.html',
  styleUrls: ['./resume.component.css']
})

 export class ResumeComponent { 
 }

enter image description here

1 Answers

In the last image, there is not app-routing.module.ts, set the file in src/app folder and in the imports, you're must write the proper address, like this.

import { ResumeComponent }      from './resume/resume.component';
import { HomeComponent }      from './home/home.component';

now the router should load the components.

Related