Angular, Appcomponent and Appmodule error, not importing

Asked

Viewed 208 times

-1

app.componentts.

import { Component } from '@angular/core';
import { AppComponent } from './app.component';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html' 
})
export class AppComponent {
  title = 'frontend';
}

  

app.modules.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

 @NgModule({
     declarations: [
         AppComponent,
     ],
     imports: [
         BrowserModule,
         AppRoutingModule
     ],
     providers: [],
     bootstrap: [AppRoutingModule]

 })

export class AppModule { }
  • Could you post the errors displayed in the angular-cli? Along with some error (if any) of the browser console? Which version of the angular used?

  • I’m using angular 9 I’m starting, I’m very lost... Failed to Compile. src/app/app.module.ts:5:30 - error TS2307: Cannot find module './app.Component' or its corresponding type declarations. 5 import { Appcomponent } from './app.Component'; This is the error, I removed the Appcomponent from the import, but still gives error

1 answer

0


To solve the problem, in the file app.component.ts it is necessary to remove the line:

import { AppComponent } from './app.component';

That way everything should work again.

  • I removed more it’s still giving error :/

  • I placed the images

  • Change the file extension app.component, the extension must be .ts, currently is .js

Browser other questions tagged

You are not signed in. Login or sign up in order to post.