我将Angular 8
与ASP.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 { }
答案 0 :(得分:0)
说明:
要在角度应用程序中使用的每个组件都必须明确 导入正确的模块,否则您将看到该错误,因为 角度找不到该组件的选择器标签
修复
确保将app-job-newlist
导入模块