我正在学习有角度的课程,我正在学习课程,但是发生了此错误。我无法解决。
这是我第一次有角度
错误
**ERROR in HostResourceResolver: could not resolve ./product-list.compoment.html in context of /home/user/angular/Angular-GettingStarted/APM-Start/src/app/products/product-list.component.ts)**
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'pm-root',
template: `
<div><h1> {{ pageTitle }} </h1>
<pm-products></pm-products>
</div>
`
})
export class AppComponent{
pageTitle: string = 'Acme Product Management'
}
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { ProductListComponent } from './products/product-list.component';
@NgModule({
declarations: [
AppComponent,
ProductListComponent
],
imports: [
BrowserModule
],
bootstrap: [AppComponent]
})
export class AppModule { }
product-list.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'pm-products',
templateUrl: './product-list.compoment.html'
})
export class ProductListComponent{
pageTitle: string = 'Product List';
}
我尝试更改
@Component({
selector: 'pm-products',
templateUrl: './product-list.compoment.html'
// to
// templateUrl: '.products/product-list.compoment.html' to
})
答案 0 :(得分:0)
下面的代码我的案例可以正常工作,这也可能对您有帮助...
@Component({
选择器:“ app-server”,
templateUrl:'server.component.html',
})
从'./server/server.component'导入{ServerComponent};
@NgModule({
声明:[
AppComponent,
ServerComponent
]
})
我正在使用角度10.0.3版本