选择器“与任何元素都不匹配

时间:2019-11-10 18:27:13

标签: javascript node.js angular typescript asp.net-core

我将Angular 8ASP.NET Core 2.2一起使用。 我有两个页面Index.cshtml和工作newlist.cshtml
在页面index.cshtml中,我使用标签<app-job-newlist></app-job-newlist>。 然后在页面newlist.cshtml中使用标签<app-jobpicload></app-jobpicload>

加载页面newlist.cshtml时,我看到错误:

  

错误错误:"The selector "app-job-newlist" did not match any elements"

这是我的代码app-modules.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { AppRoutingModule } from './app-routing.module';
//import { CommnetComponent } from './commnet/commnet.component';
import { CommentComponent } from './comment/comment.component';
import { JobListComponent } from './job-list/job-list.component';
import { JobServiceService } from './services/job-service.service';
import { JobLoadFileComponent } from './job-load-file/job-load-file.component';
@NgModule({
  declarations: [
    CommentComponent,
    JobListComponent,
    JobLoadFileComponent,

  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    HttpClientModule
  ],
  providers: [JobServiceService],
  bootstrap: [ JobListComponent]
})
export class AppModule { }

1 个答案:

答案 0 :(得分:0)

说明:

  

要在角度应用程序中使用的每个组件都必须明确   导入正确的模块,否则您将看到该错误,因为   角度找不到该组件的选择器标签

修复

确保将app-job-newlist导入模块