我被困在这里了.我收到这样的错误.

 compiler.es5.js:1694 Uncaught Error: Unexpected value 'LoginComponent' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation.
    at syntaxError (compiler.es5.js:1694)
    at compiler.es5.js:15595
    at Array.forEach (<anonymous>)
    at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver.getNgModuleMetadata (compiler.es5.js:15577)
    at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._loadModules (compiler.es5.js:26965)
    at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._compileModuleAndComponents (compiler.es5.js:26938)
    at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAsync (compiler.es5.js:26867)
    at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_._bootstrapModuleWithZone (core.es5.js:4536)
    at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_.bootstrapModule (core.es5.js:4522)
    at Object.../../../../../src/main.ts (main.ts:11)

我的登录组件如下所示

import { Component } from '@angular/Core';

@Component({
    selector:'login-component',
    templateUrl:'./login.component.html'
})

export class LoginComponent{}

应用程序.单元ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common'
import { HttpModule } from '@angular/http';
import { ReactiveFormsModule} from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';
import { AppComponent } from './main/app.component';

import {LoginComponent} from './login/login.component';


const appRoutes: Routes = [
  {path:'', redirectTo:'login', pathMatch:'full'},
  { path: 'home', component: AppComponent },
  { path: 'login', component: LoginComponent }
];

@NgModule({
  imports: [
    BrowserModule,
    RouterModule.forRoot(appRoutes),
  ],
  declarations: [
    AppComponent,
    LoginComponent
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

try 将LoginComponent导入声明时出现此错误.我是不是错过了什么.

推荐答案

你在LoginComponent的文件中输入了一个输入错误

import { Component } from '@angular/Core';

它是小写c,不是大写

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

Angular相关问答推荐

添加@ nx/webpack插件 destruct 了Nativescript构建

在RxJS和ANGING中处理多个API调用

[NullInjectorError]:R3InjectorError(Standalone[_AppComponent])[]:NullInjectorError:No provider for _HttpClient

更改动态表单控制Angular 的值

Angular 16独立依赖注入问题

Angular 16模块中未使用的组件是否从Bundle 包中删除(树摇动)?

一次重定向后,所有子路由都处于活动状态

RXJS拆分返回值,多次调用后重新加入

出错后可观察到的重用

Angular NG5002错误无效的ICU消息和意外字符EOF

使用 Angular 类构造函数来获取依赖项

大型 Angular 12 应用程序 - 我如何管理 js 文件

角 12 固态继电器 |页眉页脚在加载程序到来之前显示

个人修改 Angular CLI - 创建新应用

在 Ionic 2 中使用 NodeJS.Timer 时找不到命名空间 NodeJS

如何在 bootstrap Angular 2 应用程序时调用休息 api

初始化所有子类后的Angular 2生命周期钩子是什么?

Angular url加号转换为空格

Mat-autocomplete - 如何访问选定的选项?

模拟子组件 - Angular 2