【发布时间】:2020-03-06 13:40:37
【问题描述】:
我正在使用 Angular 8 和 ASP.NET Core 2.2。
我有两页 Index.cshtml 和 Job 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 { }
【问题讨论】:
-
那么,
app-job-newlist是在哪里定义的?通常在其中包含的组件之后命名文件,因此您应该在某处有一个job-newlist.component文件... -
是“app-job-newlist”还是“app-job-list”?您的组件文件名看起来像“JobListComponent”。任何堆栈闪电战?
标签: javascript node.js angular typescript asp.net-core